Symfony + WSSE: Why is the nonce cache folder 20GB in size?

I am working on a Symfony 3.4 based projects which uses a WSSE authentication as described in the Symfony docs.

Each nonce is stored as separate file in the cache dir myProject/var/cache/prod/security/nonces. Probelm is, that this dir becomes very, very large in size. The project has been up and running and the nonces already use almost 20GB in disk space!

$ cd myProject/var/cache/prod/security/
$ du -sch *
19G    nonces
19G    total

This seems pretty much to me… I tried to figure out how many nonces are stored and used the following command to count the files:

$ cd myProject/var/cache/prod/security/nonces
$ find -maxdepth 1 -type f | wc -l
4697417

Even for 4.7 million files 19GB seems pretty much. Each file would need to have a size of roughly about 4KB. However, as far as I can tell each file has only 10B…

$ cd myProject/var/cache/prod/security/nonces
$ ls -lh
-rw-r----- 1 user nobody 10 Jul 25 16:46 'MWFiYWM5YjAiOTRyOWRmZA=='
-rw-r----- 1 user nobody 10 Jul  1 19:41 'MWFiYWNiYTflNTdhLGYwYQ=='
-rw-r----- 1 user nobody 10 Sep 29 11:05 'MWFiYWNkNzEjZfFlCjM0OQ=='
...

I know that there is a difference between file size and consumed diskspace. However, du also shows 10B of disk space:

$ du -sb --apparent-size MWFiYWNkNzEjZfFlCjM0OQ==
10

So, how can the files use 19G of disk space while each files only uses 10B? Am I missing something? Or did I not use the commands correctly?

Isn’t there a better to store the nonces?

Of course I could delete the cache every now and then. However, this would make the nonces pretty much useless, wouldn’t it?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *