2

We are experiencing incredibly slow site performance. Any tips on where to find out how much memory the site is using, or if increasing this will increase internal site loading and navigating speed? Thanks for your help!!!

6

You're asking a loaded question. When you mention memory, how exactly are you measuring that?

Site performance can depend on a few factors, including the hosting provider, the hardware, what Craft fields you're using, etc. Craft tends to hit the database a lot so if your connection to MySQL isn't good—say on a mediocre shared hosting provider—that's going to slow you down. Using a lot of Matrix fields can really slow you do or if you're trying to fetch a lot of entries at once.

The best answer I can give without specifics—and the biggest win—is to do some caching with Craft's {% cache %} tags. Using the cache will cause Craft to look in its already generated output instead of multiple trips to the db. Anything that has a {% for %} loop block is likely going to generate a lot of db queries and is a good candidate for caching (like a navigation menu).

If you're already using caching, make sure you're doing it efficiently. Craft stores the output of the cache tag so you need to put the tags around things that actually output something—you can't cache variables.

For example:

{% cache %} 
    {% set whateverEntries = craft.entries.section('whatever') %}
{% endcache %}

{% for theEntry in whateverEntries %}
...

... won't cache anything. But this would:

{% cache %} 
    {% set whateverEntries = craft.entries.section('whatever') %}
    {% for theEntry in whateverEntries %}
        <h1>{{theEntry}}</h1>
           {{theEntry.postExcerpt}}
         ...
    {% endfor %}
{% endcache %}

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.