Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tons of I/O operations caused by NullMetadata #45

Closed
luxemate opened this issue Apr 1, 2014 · 3 comments
Closed

Tons of I/O operations caused by NullMetadata #45

luxemate opened this issue Apr 1, 2014 · 3 comments

Comments

@luxemate
Copy link

luxemate commented Apr 1, 2014

While troubleshooting my production server performance I found out that metadata library is creating a lot of tmp files and renaming to the same name on every request, as there is no property "name" in NullMetadata class (it serializes to an empty class).

Debug information from FileCache::putClassMetadataInCache:
putclassmetadataincache_debug

Example of operations from fatrace, that are made on every request:

apache2(1048): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheDIwGQx
apache2(1048): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheDIwGQx
apache2(1048): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheDIwGQx
apache2(1048): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachevRV94h
apache2(1048): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(1048): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(2950): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheAggRB7
apache2(2950): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheAggRB7
apache2(2950): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheAggRB7
apache2(2950): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheAggRB7
apache2(2950): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheAggRB7
apache2(2950): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheNwjvdS
apache2(2950): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheNwjvdS
apache2(2950): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(2950): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(983): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachecxFAVB
apache2(983): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachecxFAVB
apache2(983): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachecxFAVB
apache2(983): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachewGC6Tm
apache2(983): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachewGC6Tm
apache2(983): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachewGC6Tm
apache2(2944): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheSVFyEy
apache2(2944): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheSVFyEy
apache2(2944): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheSVFyEy
apache2(2944): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheSVFyEy
apache2(2944): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cacheDuL8Zj
apache2(2944): CWO /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(2944): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/.cache.php
apache2(2983): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachelktGRx
apache2(2983): CW /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachelktGRx
apache2(2983): O /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachelktGRx
apache2(2983): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachelktGRx
apache2(2983): W /home/luxemate/www/gamesite/app/cache/prod/jms_diextra/metadata/metadata-cachelktGRx
@staabm
Copy link

staabm commented Apr 1, 2014

this might be the reson for #44

@roberto-mansfield
Copy link

I've found the same issue debugging an issue with the creation of cache files. My composer.lock files says I'm using v1.5.0. In Metadata/Cache/FileCache.php:

public function putClassMetadataInCache(ClassMetadata $metadata)
{
    $path = $this->dir.'/'.strtr($metadata->name, '\\', '-').'.cache.php';

But if there are no annotations, then $metadata is an instance of NullMetadata and then $path points to ".cache.php". Later, when we try to reload the cache file, the "correct" name of the cache file is checked, not found, and so the code tries to generate the same cache file again. So for files with no annotations, you lose the benefit of the cache plus take a hit re-generating the "null" cache files each time.
(FYI: In our production environment, we generate our cache files as read-only which are generated when we deploy updates to our code. That is the context where I ran across this issue.)

@luxemate
Copy link
Author

Thanks for the fix, @adrienbrault!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants