When looking at a profile on why Magento 2 is super slow, I see that Less_Parser::getCss() takes 47 seconds.

Why is the server parsing LESS in production mode?

I am using magento 2.1.3.

I am also using an aftermarket theme called Porto

  • Did you find the solution ? – Franck Garnier Sep 15 '17 at 9:13
  • Nope, the below did not work for me so I will unselect it as the correct answer – Stevie G Sep 15 '17 at 17:04

This routine is going to be invoked unless you compile your LESS files via 'bin/Magento setup:static-content:deploy`.

Otherwise, Magento has to render all CSS files on every page request, that slow downs your server.

I also highly recommend to validate your installment with recommended production settings turned on:

  • dev/grid/async_indexing
  • sales_email/general/async_sending

I found the cause on my project.

Check your error log, if some css files are not well defined in the xml, Magento cannot create the merged minified file and then Magento will try to regenerate it for each request.

Moreover, if you have different css files for each request, Magento needs to rebuild the merge css file too on these requests. Check if you have some files in cache/_merged folder.

You can also check that you web server environment variable do not override the production mode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.