This topic has 48 replies, 4 voices, and was last updated 9 years by Riccardo Rossini.
-
Author
Tagged: admin-ajax.php heave_load
-
November 4, 2014 at 14:24 #33968MelamoryParticipant
Hello, dear community.
Unfortunately my web-site based on kleo experiencing heavy load by admin-ajax.php.
I tried disabling almost all of the plugins and it havent helped a lot.Problem is httpd proccesses take ~80-100% cpu and use all memory available(512mb RAM) of my VPS server.
I tried monitoring them with mon_performance and from what i see the most heavy script is
admin-ajax.php?action=kleo_bp_notifications_refresh
GET:/wp-admin/admin-ajax.php?action=kleo_bp_notifications_refresh¤t=0What can i do to stop this? It takes now users almost 5-6 seconds to open site or forum and it also influenses other applications i have installed on my VPS.
My page is http://www.noremorse.ru
November 5, 2014 at 11:02 #34145MelamoryParticipantA little update.
I found menu-notifications.php in lib/plugin-buddypress/
Inside this php i see kleo_bp_notification_refresh.
I tried to comment this action but it ain’t help.Also i noticed that refresh interval for app.js here can be changed:
$data[‘bpNotificationRefresh’] = sq_option(‘bp_notif_interval’, 20000);By changing time here from 20000 to 2000000 i managed to stop httpd proccesses load on my server to 20-30% cpu.
But still time to load page(you can see it also) is not the best.
And if i am looking at heaviest scripts(please, take a look here – http://5.63.155.58/performance-status?info=30&sort=1&tp=0&prd=1&prd_b=&prd_e=&host=&script=&uri=&mode=0) i see that this action is being repeated every 20 seconds.
What can it be and how to “ease” it?November 5, 2014 at 12:01 #34150sharmstrModeratorapp.js isnt being loaded anymore, the minified version is so you didnt actually change anything. But you dont have to change it there, you can set it in Theme Options.
I discussed my way of approaching what to set this value to in a topic when they released live notification. The default is 20 secs. Do people on your site really need to know that quickly? Look at your usage stats for the average time someone spends on a page. If it only a minute than do you even need live notification? The notification gets checked on page load, so it will fire every time someone navigates to a new page. If they are spending 5 mins on a page, then maybe set it to fire every 60 or 90 seconds. The only page that people will probably spend more time on is the activity page or if someone walks away from their computer. I would like to be able to set it to only fire x amount of times after each page load. That would take care of someone leaving the page open for hours.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 12:09 #34151MelamoryParticipantThanks, sharmstr.
Maybe it is set to deal with min version, but it actually helped me(changin value from 20000 to 2000000) a lot. I just tried to set it back and again – 90-100% cpu load.Is there a way to turn off this notifications? The ones that i see here
November 5, 2014 at 12:16 #34152sharmstrModeratortheme options -> buddypress. Set notification to 0 to turn them off.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 12:37 #34153MelamoryParticipantIt is already set up there as 0.
And i still see something pushes this notifications.
What else could it be?November 5, 2014 at 12:39 #34154sharmstrModeratorbtw – you said you set it to 2000000 which is 33 mins. According to your logs its running every 20 seconds so even if you *think* that’s what made it better, it really didnt because its clearly not running every 33 mins. What ‘sq_option(‘bp_notif_interval’, 20000);’ does is sets it to 2000 if it CANT find the ‘bp-notif-interval’ value in the database. But since its in the database, it uses the value set in theme options. So, again, you need to change it in theme options.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 12:52 #34158sharmstrModeratorOkay, I just looked at it closer and that’s not the actual call to get the notification. The action=kleo_bp_notifications_refresh is telling it how often to check. The t=0 means never. I dont see a column in your report showing the ip that’s requesting the call. How many users do you have? I’m not sure if that call is made on every page load or not. I’ll have to do some checking.
@abe – can you comment on this?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 12:57 #34160sharmstrModeratorI just set mine to 0 and and it doesnt make any calls at all. I’m not sure why yours is. Can you try setting it to 6000 in theme options and see if that slows it down to 1 minute?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 13:35 #34165MelamoryParticipantSummary
Problem
Kleo causes server instability:
* High CPU Load
* High Memory LoadSystem
Hardware:
* VPS server
* 2GHz CPU
* 512Mb RamSoftware:
* Centos 6 86_64
* Apache 2.2
* MySQL, Php
* ISP ManagerMonitoring:
1) Top/ISP Manager -> Proccesses: shows httpd(from 4 to 5) “eating” 30-50% CPU each and ~ 100mb Ram
2) Log check shows nothing interesting except for lots of internal dummy connections in httpd Access Logs(maybe its not connected with main problem)
3) Mod_performance results can be found here(live) and they show kleo_bp_notifications_refresh used by admin_ajax.php every 20 seconds as a main cpu usage.
4) Site load time is weak(2-6 seconds) and sometimes this CPU peak loads cause server to be unreachable(thus using TS server installed there to crash as well)Actions:
1) Changed prefork httpd.conf(mimimized them) to:
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 2
ServerLimit 64
MaxClients 64
MaxRequestsPerChild 0
</IfModule>from
<IfModule prefork.c>
StartServers 4
MinSpareServers 4
MaxSpareServers 6
ServerLimit 128
MaxClients 128
MaxRequestsPerChild 1000
</IfModule>Result: httpd instances gone from 4-5 to 2 in top.
2) Tried increasing Max Memory allowed in wp-config.php up to 256M
Result: none.3) Changed notification time to 0 here
Result: none, still same here4) Changed Value in …/wp-content/themes/kleo/lib/plugin_buddypress/menu-notifications.php
from
add_filter( ‘kleo_localize_app’, ‘kleo_bp_notif_refresh_int’ );
function kleo_bp_notif_refresh_int( $data ) {
$data[‘bpNotificationsRefresh’] = sq_option( ‘bp_notif_interval’, 20000 );return $data;
}
to
add_filter( ‘kleo_localize_app’, ‘kleo_bp_notif_refresh_int’ );
function kleo_bp_notif_refresh_int( $data ) {
$data[‘bpNotificationsRefresh’] = sq_option( ‘bp_notif_interval’, 2000000 );return $data;
}
Result: caused httpd proccesses to “eat” only 1-2% CPU, but still same here(shows some notifications pushed by admin_ajax.php every 20 secongs)5) Tried to comment/delete section from …/wp-content/themes/kleo/lib/plugin_buddypress/menu-notifications.php:
/* Refresh notfications by AJAX */
add_action(‘wp_ajax_kleo_bp_notifications_refresh’, ‘kleo_bp_notifications_refresh’);
…
Result: no changesResume/questions:
1) Why page load time still so weak? You can try it here: http://www.noremorse.ru
2) Why mod_performance still shows notifications pushed and CPU loaded every 20 seconds?
3) What my changes in file(20000 -> 2000000) caused and why httpd CPU usage drastically decreased?Sorry for such a long post, but i am trying to give as much information as i can.
November 5, 2014 at 13:37 #34166MelamoryParticipantSharmstr
Tried setting it to 6000 as you asked. Still see same every 20 seconds activity.
I am not telling that my CPU usage and weak page time is a result of this activity, but i see nothing else with mod_performance.November 5, 2014 at 15:15 #34183sharmstrModeratorSo, there is a difference between
admin-ajax.php?action=kleo_bp_notifications_refresh&t=0
and
admin-ajax.php?action=kleo_bp_notifications_refresh¤t=x
The first one tells it to set the time between checks. The t=0 is correct because you set it to zero. If you check now, it probably says t=6000.
The second one is the actual call to fetch the notifications (the current flag is the amount of notifications it returned during the previous call). If you look at your previous logs, you wont see the second one at all (it never fetched the notifications). That’s because you had the time interval set to 0.
So, if we were to stop there, the interval is actually being set correctly and working as it should. The issue is that it keeps setting the interval. Changing the interval time has no effect on when the set interval call is made (from testing on my site), only on the fetch notification call. What we need to figure out is why the set interval call is being triggered so many times.
Does that make sense?
Still waiting for abe to comment on this. In the meantime I’ll walk through the code.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 17:02 #34196MelamoryParticipantYes, it looks like you are right. Hope to know answer why is it triggered every 20 seconds or even more often still.
I am also wondering what i really changed in menu_notifications.php and why it helped me so much? I can make short clip or stream it to show that it really somehow lowered my cpu usage by httpd for 50-80%.
November 5, 2014 at 17:23 #34198sharmstrModeratorHave you check to see if admin-ajax.php?action=kleo_bp_notifications_refresh&t=0 is successful? Maybe its rerunning because its encountering an error?
Just had an idea. What page were you on when those performance reports were generated? All I can see is the hostname, but not the actual page that it was called from. Also, can you show the ip address that the request was coming from? You never answered my ‘how many users’ question, so I’m trying to figure out if 1 – its only happening in certain areas and 2 – if all of those are from one user.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 17:40 #34201MelamoryParticipantQ1 – “What it returns” – I don’t know. How to check?
Q2 – “Page it generated” – It is autogenerated. I guess it looks at main page. Actually if i am looking on what is going on on site with Chrome Developer functions i can see this php script runs.
Q3 – “IP address who generated” – Again – that shows me this mod_performance. I dont see there any option to see who actually generated this script. If you could show me how to do that – i would show you.
Q4 – “PPl on site” – It is 3-10 ppl online, i even checked it when i was on site alone – it were still every 20 seconds.Sorry that i can’t anwer this, – i am somewhat new to technology.
November 5, 2014 at 17:57 #34202AbeKeymasterHi @Melamory
You should not edit anything or add any code to disable the notifications refresh. You go to Theme options – Buddypress – Live Notifications interval and set 0.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 17:58 #34203AbeKeymasterAlso revert any changes you done so it is the default logic from the theme
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 18:12 #34207sharmstrModerator@abe – Its not working though. Read this: https://archived.seventhqueen.com/forums/topic/kleo-admin-ajax-php-cpu-and-memory-load#post-34183
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 19:07 #34210AbeKeymasterI’ll test it right away
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 19:20 #34213sharmstrModeratorIts not happening on my site, so its hard to figure out what’s causing it.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 19:21 #34214AbeKeymasterOK So it tested it and setting it to “0” in Theme options – Buddypress disables it
The way it works is like this:
– we read the refresh you set in theme options
– if is 0 then we don’t enable request wp-admin/admin-ajax.php?action=kleo_bp_notifications_refresh¤t=0
– if is different than 0 then the request is done with the interval set.So the request only happens if the theme option is greater than 0.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 19:22 #34216AbeKeymasterMaybe your theme options aren’t saving… try to give me temporary access
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 19:23 #34217sharmstrModeratorRight, but the problem isnt that its making the current=x request. The problem is that its continuously making the t=0 request.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 19:23 #34218sharmstrModeratorI think they are saving because the request is t=0 which I assume is time=0
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 19:24 #34219sharmstrModeratorAND there are any current=x request being made.
(I need the ability to edit my replies. lol)
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 19:29 #34221AbeKeymastertry now to edit, your a moderator 🙂
Also it should not be a t=xxx parameter, we haven’t built it that way
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 5, 2014 at 19:42 #34223sharmstrModeratorWell, god knows I tried to find where the t was being set in the code. But check out these calls. On closer inspection, its a weird carachter then t=0
COPY CODEGET:/wp-admin/admin-ajax.php?action=kleo_bp_notifications_refresh¤t=0
what the heck is this? ¤
Could it have something to do with translations?
(look at me edit. ahahaha)
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 5, 2014 at 20:13 #34231AbeKeymasteryes I see the strange char .. maybe @Melamory can provide access to check since the t=0 could be added by a caching plugin or maybe the server to prevent caching ajax requests
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 6, 2014 at 01:16 #34284MelamoryParticipantHello, guys. I can give you access, ofc.
But keep in mind that changing setting of menu_notifications.php(mentioned above interval) really saved my life with this site(idk why, thats one of the questions)Please, pm me or give me any other wait to contact you with what info you need to access this site.
Many thanks for your work.
November 6, 2014 at 22:58 #34389MelamoryParticipantStill waiting for an answer when you could look at my site strange activity.
Thanks.November 6, 2014 at 23:52 #34399AbeKeymasteryes you can give me access to take a look. give me WP and FTP access please
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 7, 2014 at 00:03 #34401AbeKeymasterhere, mark the reply as private
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 7, 2014 at 00:52 #34419AbeKeymaster@Melamory now it is not happening since you removed the notifications from the menu..
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 7, 2014 at 00:55 #34420MelamoryParticipantPlease, take a look now.
I changed that file(menu notifications.php) back to 20000.
Now again CPU usage 90%.
And no notifications in the menu.Can you see it?
November 7, 2014 at 00:56 #34421AbeKeymasterI have enabled the notication module from Settings – Buddypress, added the Notifications to the menu and set it to zero from Theme options – Buddypress and no notification refresh is occurring.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 7, 2014 at 01:00 #34423AbeKeymasterAlso the way to check if the request is done is to open browser developer tools and you can see if any request is made. From that panel with the requests you are seeing isn’t that correct since there could be users with the browser already opened and not affected by the change until they refresh the page to load the new setting
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.November 7, 2014 at 01:01 #34425MelamoryParticipantThats strange.
Here – http://5.63.155.58/performance-status?info=30&sort=1&tp=0&prd=1&prd_b=&prd_e=&host=&script=&uri=&mode=0
i dont see any refreshes anymore. So, were the problem because notifications were turned off? -
AuthorPosts
The topic ‘Kleo admin-ajax.php cpu and memory load’ is closed to new replies.