• Dear Support Team,

    is there any way to fix the loading times caused by admin-ajax.php?

    We do really need this twitch status plugin, but it causes unbelievable loading times.

    here is a screenshot:

    https://prnt.sc/e4gg8c

    Kind regards,
    Luca

Viewing 6 replies - 1 through 6 (of 6 total)
  • How many channels have you added?

    I did some checks and added a execution time per channel. Without the cache it takes avg. 1.91 secs pr channel to collect the data from twitch.

    When the cache is valid it takes no more than avg. 0.15 secs per channel, since it just need to read the files locally stored.

    The default TTL for the cache is 15 secs so you could maybe change it yourself to maybe 30 or 60? This would affect how fast it registers a person is online/offline, but instead improve your load speed.

    Thread Starter lucaffi94

    (@lucaffi94)

    We have like 60 different Streams on our website. I guess that might cause the problem.

    Is it possible to queue up the requests, so it will not request all channels at once and cause loading times of 20 seconds and more?

    Thank you very much for your help.

    Kind regards,
    Luca

    60 channels is more than I expected.

    My personal suggestion would be that you set the Ajax TTL to 600 instead of 15 and then you setup a real CRON job following this guide to run every 5 minutes since the TTL for cronjob is set to 300 sec per default. It can be that you should set this down to maybe 240 secs (4 minutes) then your 100% sure it’s updated every time the cronjob is running and Ajax would only be slow if the cronjob fails.

    https://www.siteground.com/tutorials/wordpress/setup-cron-job.htm

    How you setup the cronjob depends on your host and they might also only allow you run them every 15/30/60 minute. In that case you would have to play with both TTL.

    The cost of this solution is of course that status of the 60 streams is only updated every 5 mins (or how often cronjob is running)

    Plugin Author Nicolas Bernier

    (@nicolasbernier)

    The plugin was designed for 1 stream initially so 60 may cause problems.

    I will modify it to set a TTL accordingly to the number of streams. There is already a cron job to do this. What I will do is send the browser output in Ajax then let the script run in background to actually update the streams statuses. However this would require to allow no script time limit.

    Thread Starter lucaffi94

    (@lucaffi94)

    Okay, i can understand that. Thank you very much for your fast reply!

    If you could fix that by any time, could you update me? Because we do really need this update for our website… we would be really really grateful!

    Regards,
    Luca

    Thread Starter lucaffi94

    (@lucaffi94)

    Hello Nicolas!

    Do you have any updates regarding that issue?

    Im willing to pay you for any new script that could provide stability with more than 50 stream implemented.

    Kind regards,
    Luca

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Admin-ajax.php is causing high loading times’ is closed to new replies.