HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Reducing impact of /dashboard/notifications/inform

Andy KAndy K
edited June 2012 in Vanilla 2.0 - 2.8

It looks like on my site, the most (by far) activity used to be (URL to my forum) back on Vanilla 1. On Vanilla 2, a good 40%+ of all activity on my site is not to the html root, but POST to "(URL to my forum)/dashboard/notifications/inform". It may jack up my forum to the point where my web provider might charge me more due to the activity, so I'm looking to reduce this activity.

I see that this is not an actual path on my forum. The only thing I see in the code that mentions this path is /js/global.js:

Thank god for commenting, because I have an idea of what I might need to change:


// Ping for new notifications on pageload, and subsequently every 1 minute.
pingForNotifications = function(wait) {
if (!wait)
wait = 60000;

    setTimeout(function() {
        $.ajax({
            type: "POST",
            url: gdn.url('dashboard/notifications/inform'),
            data: {'TransientKey': gdn.definition('TransientKey'), 'Path': gdn.definition('Path'), 'DeliveryMethod': 'JSON'},
            dataType: 'json',
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                gdn.informMessage(XMLHttpRequest.responseText, 'Dismissable AjaxError');
            },
            success: function(json) {
                gdn.inform(json);
                pingForNotifications();
            }
        });

    }, wait); // Ping once a minute.
}

if (gdn.definition('SignedIn', '0') != '0')
pingForNotifications(false);

Instead of one minute (60000) I was thinking 10 minutes (600000). Any other way to lessen the impact of this section? Anything else outside of this that calls upon the path /dashboard/notifications/inform?

Thanks!
-Andy

Comments

  • SheilaSheila ✭✭
    edited July 2012

    Hi!

    Question to anybody that might know an answer to this. Is the method above recommended? Should I try it to solve my problem that is I'm running out of disk space on my server.

    This has only started after I installed Vanilla 2. I have 3GB disk space. Before Vanilla I had over 1GB left. Atm 2,5 is in use. I do have my Vanilla installed twice, other folder for actual site, other for making theme etc.

    Even before that more recent test folder, my server has crashed two times because it ran out of disk space. Been able to solve that by manually deleting log files etc.

    And if it's worth anything, just calculated different folder sizes.
    My forum is 15.6 MB, test forum 19.7 MB, Vanilla 1 4.07 MB. IPB is 13.5 MB. Practically there's almost no uploads left (except user profile photos) since I cleaned them all away after the first crash.

    What could be causing my disk space to fill up by it's own? Those none are not that big folders either. Surely it's not the traffic. And like I understand anything about these things, how come Vanilla folder is bigger compared to IPB which is supposed to be quite a monstrous? Or is it's big size only in db? Or has my ISP been just fiddling something I'm not aware of?

  • peregrineperegrine MVP
    edited July 2012

    The discussion subject should have nothing to do with your file storage issue, it has to do with message transmission.

    One thing that could adding to size that you can purge is the log files.

    it is under moderation in dashboard

    edit/delete logs.

    if you don't see the option for
    edit/delete logs

    you need to login in as the user number 1
    change your permissions file for viewing.

    I don't know if optimizing your database improves size.

    http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html

    if you have linux,

    you could do

    du -a and look for unusually large block sizes.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • SheilaSheila ✭✭
    edited July 2012

    peregrine said:
    The discussion subject should have nothing to do with your file storage issue, it has to do with message transmission.

    Ok, thanks! Sorry. I was just guessing, if those build up something somewhere.. Statistics plugin at least surely seems to have lot of stuff going on constantly.

    One thing that could adding to size that you can purge is the log files.

    it is under moderation in dashboard

    edit/delete logs.

    Will test that and see what happens. Edit: Their impact is/was just really minimal.

    I don't know if optimizing your database improves size.

    Did that with my Vanilla db few days ago, don't see much of a change.

    The thing is, it might be just a coinsidence that this disk space filling up 'on it's own' started happening after I installed Vanilla 2, but it is confusing anycase. Had not happened never before.

  • @Andy K said:
    It looks like on my site, the most (by far) activity used to be (URL to my forum) back on Vanilla 1. On Vanilla 2, a good 40%+ of all activity on my site is not to the html root, but POST to "(URL to my forum)/dashboard/notifications/inform". It may jack up my forum to the point where my web provider might charge me more due to the activity, so I'm looking to reduce this activity.

    I see that this is not an actual path on my forum. The only thing I see in the code that mentions this path is /js/global.js:

    Thank god for commenting, because I have an idea of what I might need to change:


    // Ping for new notifications on pageload, and subsequently every 1 minute.
    pingForNotifications = function(wait) {
    if (!wait)
    wait = 60000;

    setTimeout(function() {
    $.ajax({
    type: "POST",
    url: gdn.url('dashboard/notifications/inform'),
    data: {'TransientKey': gdn.definition('TransientKey'), 'Path': gdn.definition('Path'), 'DeliveryMethod': 'JSON'},
    dataType: 'json',
    error: function(XMLHttpRequest, textStatus, errorThrown) {
    gdn.informMessage(XMLHttpRequest.responseText, 'Dismissable AjaxError');
    },
    success: function(json) {
    gdn.inform(json);
    pingForNotifications();
    }
    });

    }, wait); // Ping once a minute.
    }
    if (gdn.definition('SignedIn', '0') != '0')
    pingForNotifications(false);

    Instead of one minute (60000) I was thinking 10 minutes (600000). Any other way to lessen the impact of this section? Anything else outside of this that calls upon the path /dashboard/notifications/inform?

    Thanks!
    -Andy

    Is there a way that I can have it ping only on pageload? I had issues in this thread: http://vanillaforums.org/discussion/comment/167728 and was linked here. I just don't know what code to modify // cut out. :s

  • ToddTodd Chief Product Officer Vanilla Staff

    We've done a fair amount of optimization of this code in our 2.1 branch. If need be I can add some separate configuration settings for cheap hosts.

    brianfeisterAaronWebstey
  • Ha, I didn't think InMotion Hosting was a cheap host (but I guess I don't know who else would be one).

    Am excited for 2.1 when it's ready though.

  • edited March 2013

    > @Andy K said:

    It looks like on my site, the most (by far) activity used to be (URL to my forum) back on Vanilla 1. On Vanilla 2, a good 40%+ of all activity on my site is not to the html root, but POST to "(URL to my forum)/dashboard/notifications/inform". It may jack up my forum to the point where my web provider might charge me more due to the activity, so I'm looking to reduce this activity.

    I see that this is not an actual path on my forum. The only thing I see in the code that mentions this path is /js/global.js:

    Thank god for commenting, because I have an idea of what I might need to change:


    // Ping for new notifications on pageload, and subsequently every 1 minute.
    pingForNotifications = function(wait) {
    if (!wait)
    wait = 60000;

    setTimeout(function() {
    $.ajax({
    type: "POST",
    url: gdn.url('dashboard/notifications/inform'),
    data: {'TransientKey': gdn.definition('TransientKey'), 'Path': gdn.definition('Path'), 'DeliveryMethod': 'JSON'},
    dataType: 'json',
    error: function(XMLHttpRequest, textStatus, errorThrown) {
    gdn.informMessage(XMLHttpRequest.responseText, 'Dismissable AjaxError');
    },
    success: function(json) {
    gdn.inform(json);
    pingForNotifications();
    }
    });

    }, wait); // Ping once a minute.
    }
    if (gdn.definition('SignedIn', '0') != '0')
    pingForNotifications(false);

    Instead of one minute (60000) I was thinking 10 minutes (600000). Any other way to lessen the impact of this section? Anything else outside of this that calls upon the path /dashboard/notifications/inform?

    Thanks!
    -Andy

    @Andy K, this this help much with the overhead? I am going to give it a shot but was wondering how much this helped you with your resources and if you found any other tweaks. I started using cloudflare on my domain and it has helped some. I am sure a bunch of it is just weeding out a lot of bot traffic from ever even hitting the website.

    @Todd, I would love to see some additional options for cheap hosts. I am going to test out the new version you guys put up on github with a clone of my current db in the next day or so to test too.

    It should be a good test since my current vanilla db size is 250mb (it is an old forum that has migrated a few times along the way)
    my current resource usage on the DB (just vanilla) according to dreamhost

    Conueries To Date: 12.77 MCn (The conueries (portmanteau of "connections" and "queries") column shows the sum of your connections times 25 and your queries ((connections * 25) + queries).)
    Estimated at 14.66 MCn

Sign In or Register to comment.