apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 363 forks source link

Values on statistics page not updated #1639

Open dennisjac opened 5 years ago

dennisjac commented 5 years ago

I've enabled the file and lru caches but it seems the values on the statistic page are not updated:

cache_time_us:                                46517690574
cache_hits:                                       1004351
cache_misses:                                      168951
cache_backend_hits:                               1058961
cache_backend_misses:                              114341
cache_fallbacks:                                     3028
cache_expirations:                                   9816
cache_inserts:                                     376839
cache_deletes:                                          0
...
file_cache_bytes_freed_in_cleanup:                      0
file_cache_cleanups:                                    0
file_cache_disk_checks:                                 0
file_cache_evictions:                                   0
file_cache_skipped_cleanups:                            0
file_cache_started_cleanups:                            0
file_cache_write_errors:                                0
file_cache_deletes:                                     0
file_cache_hits:                                        0
file_cache_inserts:                                     0
file_cache_misses:                                      0
lru_cache_deletes:                                      0
lru_cache_hits:                                         0
lru_cache_inserts:                                      0
lru_cache_misses:                                       0

As a result I have no idea if the LRU cache even works. (I'm trying to debug an issue with pagespeed generating large amount of write IOPS for no apparent reason)

jmarantz commented 5 years ago

Is the LRU cache configured? E.g. something like

ModPagespeedLRUCacheKbPerProcess   1024
ModPagespeedLRUCacheByteLimit      16384
jmarantz commented 5 years ago

and actually the reason it might not be configured is that for most applications, you shouldn't use it, and should instead use the shared-memory cache, so it's not replicated per apache child process.

See https://www.modpagespeed.com/doc/system for details.

dennisjac commented 5 years ago

This is what my configuration looks like:

Options
  AvoidRenamingIntrospectiveJavascript (aris)  True
  BeaconUrl (bu)                               /ngx_pagespeed_beacon
  EnableRewriting (e)                          1
  FileCacheCleanIntervalMs (afcci)             3600000
  FileCacheInodeLimit (afcl)                   500000
  FileCachePath (afcp)                         /var/cache/nginx/ngx_pagespeed_cache
  FileCacheSizeKb (afc)                        10485760
  LRUCacheByteLimit (alcb)                     32768
  LRUCacheKbPerProcess (alcp)                  16384
  RespectXForwardedProto (rxfp)                True
  RewriteLevel (l)                             Core Filters
  StatisticsPath (nsp)                         /ngx_pagespeed_statistics

The documentation says that if no explicit shared-memory cache is specified there is a default one that will be used. What are the appropriate values for the cache sizes? The file cache directory is currently 7GB in size but the default shared-memory cache in only 50MB which seems tiny. On the other hand if I would increase this to say 5GB (the server has 16GB of RAM) then the snapshotting would probably cause massive disk i/o when all of this is written out.

For some reason pagespeed is causing around 200 write IOPS for no apparent reason and my hope is that by configuring the in-memory caching correctly that I can fix this issue. It seems unlikely that pagespeed is updating so many files all the time so I suspect it might have something to do with metadata.