Jump to content

Performance issues (VPS nginx php-fpm)


Recommended Posts

Hi,

 

Installed 1.5.6.2 on a VPS that has 2GB guaranteed RAM. It runs on nginx/php-fpm, and no other site is on the VPS. I have added bunch of categories, content, products, and modules. The majority of the modules is about multiple seller/multiple shops. Caching is enabled, and recompilation is disabled. For some reason there is 6-8 seconds of wait after the initial contact to the server before each page is served. The site is www.3dprinterstore.com

 

I managed to get some debugging info (full file is attached), here is the summary:

 

 

 Load time: 2.798s
You'd better run your shop on a toaster

    config: 67ms
    constructor: 0ms
    init: 33ms
    checkAccess: 0ms
    setMedia: 1ms
    postProcess: 0ms
    initHeader: 6ms
    initContent: 1.585s
    initFooter: 141ms
    display: 965ms

Hook processing: 1.703s / 25.36 Mb

    displayLeftColumn: 867ms / 2.41 Mb
    displayRightColumn: 304ms / 1.88 Mb
    actionProductListOverride: 232ms / 1.31 Mb
    displayFooter: 141ms / 2.9 Mb
    displayTop: 86ms / 7.22 Mb
    displayHeader: 70ms / 9.34 Mb
    moduleRoutes: 4ms / 0.3 Mb
    TemplateMelaSlider: 0ms / 0 Mb
    DisplayOverrideTemplate: 0ms / 0 Mb
    actionFrontControllerSetMedia: 0ms / 0 Mb
    actionDispatcher: 0ms / 0 Mb

Memory peak usage: 47.3 Mb

    config: 12.91 Mb (13.1 Mb)
    constructor: 0 Mb (13.1 Mb)
    init: 6 Mb (19.2 Mb)
    checkAccess: 0 Mb (19.2 Mb)
    setMedia: 0.23 Mb (19.3 Mb)
    postProcess: 0 Mb (19.3 Mb)
    initHeader: 0.02 Mb (19.5 Mb)
    initContent: 23.13 Mb (42.9 Mb)
    initFooter: 2.92 Mb (45.5 Mb)
    display: 1.15 Mb (47.3 Mb)



Total cache size (in Cache class): 0 Mb
DB type: DbPDO
SQL Queries: 851 queries
Time spent querying: 147ms
Included files: 236
Size of included files: 3.48 Mb
Globals (> 1 Ko only): 411 Ko

    _LANG ˜ 93.7 Ko
    context ˜ 50.3 Ko
    smarty ˜ 50.3 Ko
    _MODULES ˜ 42.3 Ko
    HTTP_SERVER_VARS ˜ 12 Ko
    _SERVER ˜ 12 Ko
    _ENV ˜ 11.3 Ko
    HTTP_ENV_VARS ˜ 11.2 Ko
    _COOKIE ˜ 3.9 Ko
    HTTP_COOKIE_VARS ˜ 3.9 Ko
    _REQUEST ˜ 3.9 Ko

 

 

There are tons of category-related queries. Some categories have 50-100 sub categories. I am wondering if that is causing any issues.

 

I also watch the status of the server processes with TOP command in the console. During the initial request I can see that php-fpm spikes to 99% for few seconds. Yikes!

 

I changed caching from file to APC. I also disabled bunch of modules that weren't in use. Any ideas on where else to check? Thank you.

 

EDIT: I enabled zlib compression in php.ini and restarted php-fpm. Seems little faster, but still delayed compared to other ecommerce sites I have built.

3dps_profile.txt

Edited by rhino2 (see edit history)
Link to comment
Share on other sites

 Load time: 2.798s

 

    config: 67ms

    constructor: 0ms

    init: 33ms

    checkAccess: 0ms

    setMedia: 1ms

    postProcess: 0ms

    initHeader: 6ms

    initContent: 1.585s

    initFooter: 141ms

    display: 965ms

 

Something is not adding up.  You say there is a 6-8 second delay, but the reported load time is 2.798 seconds.  Can you confirm if there is 4-5 seconds not being tracked by Prestashop here?

 

You are using a custom theme, so it is going to be difficult to say if this is a core issue with Prestashop or one of the packaged Prestashop modules, or a theme module.

 

According to PS reporting, most of your time is spent in initContent (1.5 seconds) and display (965ms), so this is where I would focus my time first.

 

Most of that initContent is from the Hook processing, with a majority in left column

 

Hook processing: 1.703s / 25.36 Mb

 

    displayLeftColumn: 867ms / 2.41 Mb

    displayRightColumn: 304ms / 1.88 Mb

    actionProductListOverride: 232ms / 1.31 Mb

    displayFooter: 141ms / 2.9 Mb

    displayTop: 86ms / 7.22 Mb

    displayHeader: 70ms / 9.34 Mb

    moduleRoutes: 4ms / 0.3 Mb

    TemplateMelaSlider: 0ms / 0 Mb

    DisplayOverrideTemplate: 0ms / 0 Mb

    actionFrontControllerSetMedia: 0ms / 0 Mb

    actionDispatcher: 0ms / 0 Mb

 

Your left column has 4 modules (category, information, tags, twitter).  I would disable those 4 modules and confirm that the 867ms goes down to 0ms.  Then enable them 1 by 1 and watch the time as it increases to see which module is causing that issue.  It is going to be the category module, without a doubt.  With that many categories you are going to need an advanced category block that implements caching

 

Your top menu is likely going to suffer from the same problem, since the Home menu is your categories also.

 

If you can get the PS load time down to 1 or 1.5 seconds, that is likely the best you are going to do.  With 851 queries being executed at 147ms, I'd have to say that your database is tuned just fine, and there are likely no index issues.

 

Once you get the PS load time down, then you can look into a CDN to offload some of those static resources and get the browser display to be quicker, as well as a page caching module that could further reduce the load to 100ms.  That comes at the cost of caching the entire page for a period of time, so things like your 'blog' would not reflect any updates until the cache expires.

 

Have fun !

Link to comment
Share on other sites

That is not the problem. I also have that delay in connection while nothing happens. Once the connection is properly stablished the shop performance is really fast even without caching. Please clarify why there is that delay, because my CPU doesn't even reach the 1% load when I load a page.

Edited by chromafunk (see edit history)
Link to comment
Share on other sites

Thank you all for your answers, much appreciated.

 

I could not isolate the issue to one specific module, however something might be causing some sort of leak.

 

When I restart php-fpm from the console, things work really nice and smooth. Overtime, I will have this CPU issue.

 

Right now, while watching the server resources with top command, php-fpm gets a tiny CPU hike for half a second on every request, and everything works fine.

 

Later today I bet it will be just like before I restarted php-fpm, any page load would make CPU 99% for 6-8 seconds which would make the client wait.

 

@chromafunk To clarify, the delay happens like this: I click on a link. Request has been sent to the server, and the browser is "Waiting for reply" while the server CPU is busy at 99%. At this point nothing is happening on the client side, not even a blank page, since the server is too busy doing something for 5-6 seconds. As soon the CPU usage goes down, the page is served in a blink of an eye.

Edited by rhino2 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...