Forum OpenACS Q&A: Re: Performance Problems - what is the bottleneck?

What excactly are you serving in you static site?
all the images? or are you still service images in you dinamic site? (verify your request logs)

In your .LRN dinamic server:
how many ram is consuming the nsd process?

In PG, increase:
shared_buffers = 65636
sort_mem = 32168

You're running vacuum analyze at least once a day, right?
pg_autovacuum is as well very good option.

Are your CR files stored in the file system?
if not, try to move all of them, and set your applications to use the fs and not the db.

Probably one effective way to increase performance, is to reduce the amount of requests to your dinamic server.
One way to achieve that is to put ALL your static files (images, css, etc) into the resources folder of each package, and then put them into your static site, and add a rule into pound to redirect /resources/* to the static site, so it goes like this:

/pkg1/www/images/img.gif
you move it to
/pkg1/www/resources/img.gif
and then you change your .adp /.tcl that refers to that img.gif
(href=/resources/pkg1/img.gif)
and put that files using the same paths in your static site
/www/resources/pkg1/img.gif
then add the rule to pound
/resources.*
and all of those files will be served from static site

After, you'll need a way to sync your dinamic and static site, but that's easy.

Do you have public areas of your .LRN site that are viewed by many users, and do not change so often?
(that sort of areas are good candidates to be replicated as static, and have procs to put them up-to-date after something has changed)

Next step will be to have a cluster.

How many concurrent connections do you have at peak times?
Try this in your dinamic system:
while [ 1 ]; do echo -n `date` >> tcp_report.txt; echo -n ' | ' >> tcp_report.txt; lsof | grep 8000 | grep TCP | grep -v LISTEN | wc -l >> tcp_report.txt; done;
(thanks to Derick)

Also look for blocked processes in PG (something that is waiting or blocked for too long sometimes reduces the performance, you can kill it). ps axuf

Collapse
Posted by Steve Manning on
In PG, increase:
shared_buffers = 65636
sort_mem = 32168

I would be careful of setting shared_buffers so high. Several Pg tuning articles suggest that this can cause performance degradation. Its not a straight forward calculation however so testing different values might be worthwhile. Setting shared_buffers to about 6% of memory (about 31457 on a 4Gb machine) should be starting point especially when used in conjunction with effective_cache_size set to a decent value.

A decent effective_cache_size allows the query planner to uses indexes instead of sequential scans. On a mchine dedicated to Pg this value can be set very high between 2/3 and 3/4 of RAM seems to be the suggestion - Nima has this set to 786432 which equates to 6Gb - might be a tad high on a 4Gb machine. Again experimentation to find a good value seems to be the order of the day.

- Steve