Okay
  Public Ticket #770770
Slow and jittery and high CPU
Closed

Comments

  • Jason started the conversation

    I've recently started using TheFox and noticed that unless I'm on a new PC the site scrolling is really jittery and slow and at the point the "back to top" button appears it goes really sluggish momentarily. It's a really lightweight page too with just a background image with overlay and some text and a few images.

    On a new PC it seems to be OK. Watching CPU usage I can see it sky rockets into 150%+ CPU (it's a dual core computer) when scrolling. In comparison, scrolling on another website such as the page for TheFox on the Enavto Market website (http://themeforest.net/item/thefox-responsive-multipurpose-wordpress-theme/11099136?s_rank=3) the CPU never rises above 20%.

    Running a profile of the CPU in Google Chrome I can see there's huge amounts of jQuery activity happening constantly, and when scrolling even more is happening.

    Constant activity seems to involve some 100ms intervals that run constantly creating jQuery selectors to fix up Visual Composer rows (vc_check) and something about height (fixHeight) and also something to fix something Woo related (woo_fix). A lot of this seems like it could be done in CSS and does it really need to run every 100ms? Is not once enough?

    It also seems attached to the scroll event are several heavy functions which ALL run (sometimes many) jQuery selectors on every single scroll event. One of them is related to sticky navigation (sticky_navigation) and seems to ONLY do something when the nav needs to be stuck, or unstuck, yet it runs every scroll event and just repeats over and over and over the sticky settings, calling lots of jQuery selectors over and over again. There's also some Module Animation event that every scroll event runs 27 jQuery selectors.

    Disabling all of this brings the CPU down to normal and the jittering stops completely.

    Are there plans to fix these to cache the jQuery selectors, reduce intervals to single hits or CSS, and even prevent the registering of intervals if not required (we don't have any Woo on the page). And any plans to fix the scroll event callbacks so they are optimised?

    There's some good guidance on scroll event abuse here: http://ejohn.org/blog/learning-from-twitter/

  •  895
    TheFox replied

    Hello Jason, thanks for purchasing Thefox and thanks for the feedback!

    We are in fact working on our next "big" update that will include a new demo and we are thinking of doing some javascript change.

    Did you already made the change to the customjs.js file?

    Also sorry for the late reply, our dev that is working on the javascript part wasn't available until this weekend.

    Regards

  • Renan replied

    I'm following this problem, because I also have these cpu usage spikes.

    Any news on that?

    Thanks

  • Renan replied

    Sorry to post again here, but I'm just not happy with The Fox...

    You have a great theme, beautiful, absolutely awesome... But it's a white elephant with all respect.

    I had before a simple theme (the station) and I decided to change to TheFox on May 09. Since then I'm having tons of problems regarding to CPU usage.

    TheFox is creating dozens of "index.php" processes with 50% to 90% of CPU usage. I tried everything, from disabling revolution slider, to disabling ajax on index, disabling some javascripts (as mentioned here), everything and still nothing. Just today I had to reboot my dedicated server (where it's running) twice. I the last 15 days, I've rebooted this server 11 times.

    I never had to do this using the station on this very same dedicated server. Now it's almost every day.

    Your theme is simply TOO HEAVY. It loads tons of unnecessary stuff we can't disable (recent blog posts for instance, if you put 5 of this shortcode in your index, it will run 5 admin-ajax.php at the same time; this is suicidal when I'm having 80 users visiting my website at once) ...

    My website have around 7k unique visitors a day, 20k posts and 20k users. During 'business time' we have around 70 to 90 visitors. It seems that TheFox is made for small blogs, because I can only run it normaly at the weekends, when I have no more than 15 users simultaneously...

    Are you guys aware of that? Is there something beeing prepared in the future to solve this?

    ***Edit to include: 


  •  895
    TheFox replied

    Hello Renan,

    About the recent post we are doing an update stoping the use of ajax when the module doesn't use the load more options, this will make the page smoother for sure.

    For the other problem you have it maybe a problem with the other plugins or settings you are using for your server, also may depends on your server type.

    If you can create a new ticket in private and give us the additional information we may be able to suggest you some changes to fix those problems.

    Regards

  • Renan replied

    Hello support

    Thank you for your quick response. Actually my support period expired on March, 1st. So I can't create any tickets. (I bought TheFox last year, but only started to use it in production this year)

    I already tried to disable other plugins. I kept only TheFox theme and Woocommerce running, and the high cpu usage persists. When we start navigation, we have spikes that goes to 80% of cpu usage, then starts to decrease. I have also tried to load only specific plugins on homepage and single.php, but nothing of these seems to work out. It really seems like a theme problem.

    I think maybe TheFox is not calling WP Query the best way. For instance, we have a call for WP Query in 404.php. Why?

    Another thing, is it possible to cache results for recent blog posts shortcode? I mean, I don't have to show new posts on Homepage as soon they are published, I can have a few hours of cache here. I did modified your code a bit, so we don't use admin-ajax at all and load results from transients in recent blog posts shortcode.

    I'm on a dedicated server with only this website and WP installation. It's a Single Xeon Quad-Core E3-1231 v3 3.4Ghz w/HT with 8gb of RAM. Server shouldn't be the problem. I'm also using W3TC with disk enhanced for page and XCache for database and object, plus Cloudflare and MariaDB.

    I don't deny we may not have the best configs for our server, but we were using this exact server before The Fox and never had any problems. All our conclusions lead to TheFox as a bottleneck, unfortunatelly.

    About the ajax, is not only the load more option the problem I think.  The first load already is made using ajax. That way, if I have 5 blocks of recent blog posts shortcode in Homepage, for example, it will load admin-ajax.php 5 times at the same time. Independently of load more. And of course, we should cache this results.

    Again, I think it's worth saying, TheFox runs way better when we have no more than 15 visitors. But we have around 70 to 90 visitors simultaneously on workdays. It is when our problems starts.

    Thanks again.