How can I test that resource (file based cache for caching output of a webapp in Perl) behaves sanely under concurrent access to said shared resource?
I wrote a simple file-based cache, written in Perl, which uses locking to serialize write access, i.e. to have only one process that (re)generates cache entry. This cache is to be used for caching output of Perl webapp (gitweb), if it matters.
I'd like to test that said cache behaves sanely under concurrent access, for example that only one process would run subroutine used to generate cache ($cache->compute($key, sub { ... })
), that all processes would get generated data, that if process writing to cache entry dies it wouldn't deadlock processes waiting for cache to be (re)generated etc.
How should I do it? Is there a ready Perl module that I can use?