Forum OpenACS Q&A: Re: Aolserver 4.5 multithreading
Thanks for the script, here is the result of running it.
FILE Start===============
ns_section ns/db/drivers
ns_param postgres /usr/local/aolserver/bin/nspostgres.so
ns_section ns/db/pool/pool1
ns_param maxidle 600
ns_param maxopen 2400
ns_param connections 20
ns_param verbose false
ns_param extendedtableinfo true
ns_param logsqlerrors false
ns_param driver postgres
ns_param datasource localhost:5432:myserver
ns_param user myserver
ns_param password xxxxxxxxxxxxxxxxxxxx
ns_section ns/db/pool/pool2
ns_param maxidle 600
ns_param maxopen 2400
ns_param connections 20
ns_param verbose false
ns_param extendedtableinfo true
ns_param logsqlerrors false
ns_param driver postgres
ns_param datasource localhost:5432:myserver
ns_param user myserver
ns_param password xxxxxxxxxxxxxxxxxxxx
ns_section ns/db/pool/pool3
ns_param maxidle 600
ns_param maxopen 2400
ns_param connections 20
ns_param verbose false
ns_param extendedtableinfo true
ns_param logsqlerrors false
ns_param driver postgres
ns_param datasource localhost:5432:myserver
ns_param user myserver
ns_param password xxxxxxxxxxxxxxxxxxxx
ns_section ns/db/pools
ns_param pool1 {Pool 1}
ns_param pool2 {Pool 2}
ns_param pool3 {Pool 3}
ns_section ns/ldap/pool/ldap
ns_param user cn=admin,ou=SysAdmin,dc=myserver,dc=net
ns_param password xxxxxxxxxxxxxxxxxxxx
ns_param host box-2.myserver.net
ns_param connections 2
ns_param verbose On
ns_section ns/ldap/pools
ns_param ldap {LDAP Pool}
ns_section ns/mimetypes
ns_param Default text/plain
ns_param NoExtension text/plain
ns_param .pcd image/x-photo-cd
ns_param .prc application/x-pilot
ns_param .xls application/vnd.ms-excel
ns_param .doc application/vnd.ms-word
ns_section ns/parameters
ns_param serverlog /var/lib/aolserver/myserver/log/error.log
ns_param home /usr/local/aolserver45
ns_param maxkeepalive 30
ns_param logroll on
ns_param maxbackup 5
ns_param debug false
ns_param mailhost localhost
ns_param HttpOpenCharset utf-8
ns_param URLCharset utf-8
ns_param HackContentType 1
ns_param OutputCharset iso-8859-2
ns_section ns/server/myserver
ns_param directoryfile index.adp,index.html,index.htm
ns_param pageroot /var/lib/aolserver/myserver/www
ns_param maxconnections 250
ns_param maxdropped 0
ns_param maxthreads 60
ns_param minthreads 20
ns_param threadtimeout 120
ns_param globalstats false
ns_param urlstats true
ns_param maxurlstats 1000
ns_param ConnsPerThread 125
ns_section ns/server/myserver/acs/acs-rollout-support
ns_section ns/server/myserver/adp
ns_param map /*.adp
ns_param enableexpire false
ns_param enabledebug false
ns_param defaultparser fancy
ns_param cache true
ns_param cachesize 1024000
ns_section ns/server/myserver/adp/parsers
ns_param fancy .adp
ns_section ns/server/myserver/db
ns_param pools *
ns_param defaultpool pool2
ns_section ns/server/myserver/ldap
ns_param pools *
ns_param defaultpool ldap
ns_section ns/server/myserver/module/nsjava
ns_param enablejava off
ns_param verbosejvm off
ns_param loglevel Notice
ns_param destroyjvm off
ns_param disablejitcompiler off
ns_param classpath /usr/local/jdk/jdk118_v1/lib/classes.zip:/usr/local/aolserver/bin/nsjava.jar:/var/lib/aolserver/myserver/www/webmail/java/activation.jar:/var/lib/aolserver/myserver/www/webmail/java/mail.jar:/var/lib/aolserver/myserver/www/webmail/java
ns_section ns/server/myserver/module/nslog
ns_param debug false
ns_param dev false
ns_param enablehostnamelookup false
ns_param file /var/lib/aolserver/myserver/log/myserver.log
ns_param logcombined true
ns_param extendedheaders COOKIE
ns_param logreqtime true
ns_param maxbackup 1000
ns_param rollday *
ns_param rollfmt %Y-%m-%d-%H:%M
ns_param rollhour 0
ns_param rollonsignal true
ns_param rolllog true
ns_section ns/server/myserver/module/nsopenssl
ns_param ServerPort 443
ns_param maxinput 20971520
ns_section ns/server/myserver/module/nsopenssl/defaults
ns_param server users
ns_param client client
ns_section ns/server/myserver/module/nsopenssl/sslcontext/client
ns_param Role client
ns_param ModuleDir /var/lib/aolserver/myserver/etc/certs
ns_param CertFile certfile.pem
ns_param KeyFile keyfile.pem
ns_param Protocols {SSLv2, SSLv3, TLSv1}
ns_param CipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
ns_param PeerVerify false
ns_param PeerVerifyDepth 3
ns_param Trace false
ns_param SessionCache true
ns_param SessionCacheID 1
ns_param SessionCacheSize 512
ns_param SessionCacheTimeout 300
ns_section ns/server/myserver/module/nsopenssl/sslcontext/users
ns_param Role server
ns_param ModuleDir /var/lib/aolserver/myserver/etc/certs
ns_param CertFile certfile.pem
ns_param KeyFile keyfile.pem
ns_param Protocols {SSLv3, TLSv1}
ns_param CipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
ns_param PeerVerify false
ns_param PeerVerifyDepth 3
ns_param Trace false
ns_param SessionCache true
ns_param SessionCacheID 1
ns_param SessionCacheSize 512
ns_param SessionCacheTimeout 300
ns_section ns/server/myserver/module/nsopenssl/sslcontexts
ns_param users {SSL context used for regular user access}
ns_param client {SSL context used for outgoing script socket connections}
ns_section ns/server/myserver/module/nsopenssl/ssldriver/users
ns_param sslcontext users
ns_param port 443
ns_param hostname myserver.net
ns_param address xxx.xxx.xxx.xxx
ns_param maxinput 20971520
ns_param recvwait 300
ns_section ns/server/myserver/module/nsopenssl/ssldrivers
ns_param users {Driver for regular user access}
ns_section ns/server/myserver/module/nspam
ns_param PamDomain pam_domain
ns_section ns/server/myserver/module/nssock
ns_param timeout 120
ns_param address xxx.xxx.xxx.xxx
ns_param hostname myserver.net
ns_param port 80
ns_param maxinput 20971520
ns_param recvwait 300
ns_section ns/server/myserver/modules
ns_param nssock /usr/local/aolserver/bin/nssock.so
ns_param nslog /usr/local/aolserver/bin/nslog.so
ns_param nssha1 /usr/local/aolserver/bin/nssha1.so
ns_param nscache /usr/local/aolserver/bin/nscache.so
ns_param libthread /usr/local/aolserver/lib/thread2.6.4/libthread2.6.4.so
ns_param nsldap /usr/local/aolserver/bin/nsldap.so
ns_param nsdb /usr/local/aolserver/bin/nsdb.so
ns_section ns/server/myserver/redirects
ns_param 404 global/404
ns_param 403 global/forbidden.html
ns_param 500 global/500
ns_section ns/server/myserver/tcl
ns_param library /var/lib/aolserver/myserver/tcl
ns_param autoclose on
ns_param debug false
ns_param nsvbuckets 33
ns_section ns/server/myserver/tdav
ns_param propdir /var/lib/aolserver/myserver/data/dav/properties
ns_param lockdir /var/lib/aolserver/myserver/data/dav/locks
ns_param defaultlocktimeout 300
ns_section ns/server/myserver/tdav/share/share1
ns_param uri /dav/*
ns_param options {OPTIONS COPY GET PUT MOVE DELETE HEAD MKCOL POST PROPFIND PROPPATCH LOCK UNLOCK}
ns_section ns/server/myserver/tdav/shares
ns_param share1 OpenACS
ns_section ns/servers
ns_param myserver {myserver Community}
ns_section ns/threads
ns_param mutexmeter true
ns_param stacksize 1048576
=========File End
Okay, so the basic default and error threadpools will use the info in
ns_section ns/server/myserver ns_param directoryfile index.adp,index.html,index.htm ns_param pageroot /var/lib/aolserver/myserver/www ns_param maxconnections 250 ns_param maxdropped 0 ns_param maxthreads 60 ns_param minthreads 20 ns_param threadtimeout 120 ns_param globalstats false ns_param urlstats true ns_param maxurlstats 1000 ns_param ConnsPerThread 125
If you want to setup additional threadpools, you should look at the following example:
http://rmadilo.com/m2/servers/jnm/config/
The virtual server setup is in server.tcl, this ends up calling the other files in that directory for individual modules. But note, that you need to select different names than default or error for your specialized threadpools, otherwise the name will overwrite the values above.
You should also load the nscp module (ns control port), so that you can login to the running server and use [ns_pools list] and [ns_pools get] to get a list of the current threadpools and their settings:
tom@localhost ~ $ telnet localhost 9999 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. login: nsadmin Password: x Welcome to jnm running at /web/nsd45/bin/nsd (pid 21784) AOLserver/4.5.0 (aolserver4_5) for linux built on Aug 12 2007 at 09:18:31 CVS Tag: $Name: $ jnm:nscp 1> ns_pools list jnm-fast tutos-default default tutos-fast error jnm:nscp 2> ns_pools get jnm-fast minthreads 2 maxthreads 10 idle 2 current 2 maxconns 100 queued 0 timeout 120 jnm:nscp 3>
The nscp.tcl file has the setup needed, the password is x. Note that this is to localhost, only a local user can login, you have to use ns_encrypt to create a new password.
my server suddenly freezes under load. The server is still runing by not responding and there log freezes as well.
I use nscp to get some details:
nscp 22> ns_pools get default
minthreads 0 maxthreads 150 idle 0 current 100 maxconns 750 queued 21891 timeout 120
Any idea?
I've been playing with maxthreads and maxconnections. With smaller values the server freezes even earlier. This is a 2 CPU system with 4 cores, 64bit linux suse and 4 GB ram. I am using aolserver 4.5.
-gustaf neumann