The cache folder has grown very fast.

I am using Symfony2 in one critical application. For each client (each tab in the browser is a client) JS through AJAX request data every second. And folder / cache / dev / profiler / grew really fast! 17Gb in 2 days! How can I disable this entry?

+9
source share
4 answers

There is an option in config_dev.yml:

framework:
    profiler: { only_exceptions: true }

It was false, now everything is fine.

+20
source

Check if your environment is running in dev (development) mode if you are convinced that it is on prod (production). In dev mode, alot proccessing is done for debugging reasons, and this is not necessary for your clients.

if you want to disable the profiler, you can do this In: app/config/config_dev.yml

web_profiler:
     toolbar: true
     only-exceptions: true
     intercept_redirects: false
+1
source

* * * * * root cd /path/to/project/src/var/cache/dev/profiler && sed -i ':a;$q;N;101,$D;ba' ./index.csv && ls -1t | tail -n +102 | xargs rm -rf

:

sed -i ':a;$q;N;101,$D;ba' ./index.csv index.csv, 100. ( )

ls -1t | tail -n +102 | xargs rm -rf , 100, .

102 - index.csv

+1

This is the best solution, you can store your profiler data in Redis thanks to SncRedisBundle , they implemented profiler_storage .

They also added TTL, so your profiler data may expire automatically.

First configure the snc_redis client in config.yml

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: redis://localhost

Then add the profiler repository to config_dev.yml

snc_redis:
    profiler_storage:
        client: default
        ttl: 86400
0
source

All Articles