Forum OpenACS Q&A: Response to Simple caching of html content

Collapse
Posted by Jeff Davis on
There is already a parameter for memoize:
ns_cache create util_memoize -size 
    [ad_parameter -package_id [ad_acs_kernel_id] MaxSize memoize 200000]
I think the default of 200k bytes is absurdly small as a default for a production machine.

More memory is taken by the nsv's and of course they cannot really be sized. I checked and here are the top ten nsv's by size

entries bytes nsv
 170     5236 locale
  49     8811 site_nodes
  41    10522 ad_page_contract_filters
 192    54013 api_library_doc
1580    97454 apm_library_mtime
2190   170279 proc_source_file
2189   336690 proc_doc
  94   574815 apm_version_properties
2189  1115145 api_proc_doc
3134  1332667 OACS_FULLQUERIES
The memory footprint of my server is 37mb and as far as I can tell, there is only ~4mb cached (although there are some nsv's I skipped like the parameter cache and and some others but I think they are smaller ones). This is on my testing site with all packages installed and mounted (some several times).

Anyway, the short answer is that things are bloated and it does not seem to really be overly aggressive caching. I think the real issue is that there are just a huge number of procedures defined.

The source for all the tcl libraries is ~3mb and I think when they get bytecode compiled you end up keeping src and bytecode around so that is a big piece of the pie. Also, I am not sure how much compiled templates end up taking, although they are done on demand so an empty idle server should not have very many loaded.

I suppose we could look at making query cached on demand, put in a size limited ns_cache, or not cached at all. Also we could ad a parameter to disable proc doc stuff by default and that might help but again, it oes not seem like either of these would make a huge difference.