- Increase number of concurrent connections to the DB in alfresco-global.properties
[bash]
# Number below has to be the maxThreads value + 75
db.pool.max=275
[/bash]
- Increase number of threads that Tomcat will use in server.xml – section 8080, 8443 and 8009 in case you use AJP
[bash]
maxThreads=“200”
[/bash]
- Adjust the amount of memory you want to assign to Alfresco in setenv.sh or ctl.sh (which is the default one):
[bash]
export CATALINA_OPTS=" -Xmx=16G -Xms=16G"
[/bash]
- Remember to disable all unneeded services
- Enable JodConverter instead of Libreoffice (only Enterprise)
[bash]
ooo.enabled=false
jodconverter.enabled=true
[/bash]
[bash]
alfresco.batch.count=2000
solr.filterCache.size=64
solr.filterCache.initialSize=64
solr.queryResultCache.size=1024
solr.queryResultCache.initialSize=1024
solr.documentCache.size=64
solr.documentCache.initialSize=64
solr.queryResultMaxDocsCached=2000
solr.authorityCache.size=64
solr.authorityCache.initialSize=64
solr.pathCache.size=64
solr.pathCache.initialSize=64
[/bash]
[bash]
mergeFactor change it to 25
ramBufferSizeMB change it to 64
[/bash]
April/9/2015 Update! For Solr4 (Alfresco 5.x) add next options to its JVM startup options:
[bash]
-XX:+UseConcMarkSweepGC -XX:+UseParNewGC
[/bash]
- For MySQL in my.cnf configuration file:
[bash]
innodb_buffer_pool_size = 4GB
max_connections=600
innodb_log_buffer_size=50331648
innodb_log_file_size=31457280
innodb_flush_neighbors=0
[/bash]
- For Postgres in postgresql.conf configuration file
[bash]
max_connections = 600
[/bash]
- Change limits in /etc/security/limits.conf to the user who is running your app server, for example “tomcat”:
[bash]
tomcat soft nofile 4096
tomcat hard nofile 65535
[/bash]
If you start Alfresco with a su -c option in /etc/init.d/, for Ubuntu you have to uncomment the pam_limits.so line here /etc/pam.d/su, if this is using login (by ssh) it is uncommented by default. For RedHat/Centos this line has to be uncommented here /etc/pam.d/system-auth.
- Your storage throughput should be greater than 200 MB/sec and this can be checked by:
[bash]
# hdparm -t /dev/sda
/dev/sda:
Timing buffered disk reads: 390 MB in 3.00 seconds = 129.85 MB/sec
[/bash]
- Allow more concurrent requests by editing /etc/sysctl.conf
[bash]
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.ip_local_port_range = 2048 64512
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
[/bash]
- A server full reboot is a good preventive measure before going live, it should start all needed services in case of contingency and we will find if we left something back on the configuration.
Nice article Toni.
Thanks Mike. Any add is welcome!
Didn’t know about those kernel optimizations. It’s a pretty useful quick reference. Thanks Toni.
Toni, is there a reason to adjust memory in catalina.sh? Wouldn’t it be better to do this in setenv.sh?
Append/Adjust memory by including this line in setenv.sh:
export CATALINA_OPTS=” -Xmx=16G -Xms=16G”
Hi Gi! Thanks for your comment. I totally agree with you, this is a cleaner way to do it. I will improve the blog post with it. Thanks!
Hi Toni and Gi:
Nice post (as usual). I would say that in the default installer, the “default” JVM options for the heap memory ($JAVA_OPTS) are set in $ALF_HOME/tomcat/scripts/ctl.sh (which is called by alfresco.sh).
Although it is usual to set java and catalina properties in setenv.sh in Tomcat, I think it is better to set them in ctl.sh, for getting all JVM config in the same place.
I would say too, maxThreads in Tomcat (7) are 200 by default (in http and ajp).
Regarding filehandlers, you have to take into account how your java process for tomcat is launched (for example, if su is used in linux init script). Maybe it is necessary to enable user limits (pam_limits.so) for /etc/init.d/su
Regards.
–C.
Hi Cesar, thank you very much for your feedback.
Either way is fine, in most cases it depends on the installation using the installer, using ctl.sh or setenv.sh or any other place where the administrator got control of that.
On the maxThreads this is a change for Alfresco One 5.0 but it still being a good advice for previous deployments.
Cesar, could you give me a valid example for /etc/init.d/su configuration file please?
Cheers.
Hi Toni:
I’m agree that JVM propeties can be set in both files, but as the default Alfresco JVM config is in ctl.sh I prefer to put it there. If not, you can set heap settings in two diferent files (and twice, and that is a problem). Tomcat admin goes to set up to setenv.sh, instead of ctl.sh (where are defined by default). This is if you append, if you override in setenv.sh, you probably miss other important JVM settings for example, related to JMX.
I send you a file for Ubuntu 14.04 LTS Server Edition (or 12.04) by mail. Anyway you should check that this file contains the next (by default it is commented):
# Sets up user limits, please uncomment and read /etc/security/limits.conf
# to enable this functionality.
# (Replaces the use of /etc/limits in old login)
session required pam_limits.so
–C.
Thanks Cesar, I see, if you start Alfresco with a su -c option in /etc/init.d/, in Ubuntu you have to uncomment the pam_limits.so line here /etc/pam.d/su, if this is using login (by ssh) it is uncommented by default. For RedHat this line has to be uncomented here /etc/pam.d/system-auth.
Adding this information to the article, I think now is more clear. Thanks!
Right! Depending on how you launch the java process (in a login shell via ssh, via su or sudo in a init script, even via alfresco.sh directly) the security settings for filehandlers are inherited or not. Probably not necessary with with a “Tomcat daemon”. Thanks for the Red Hat feedback.
–C.
Thanks Toni, Excellent article.
Hi Tony,
Thanks for this excellent post.
On ubuntu the max value for servernet.core.somaxconn is 65535 and not 65536
Stephane
Yep, you are right, fixed! Thanks Stephane!
Toni, Are the solr tunnings for SOLR 1.4 or for SOLR 4.x ?
Regards.
–C.
I use to config the swapping management. If there is only one application running in your server(Alfresco), vm.swappiness=1 or 0(No swapping or only in so very special moment). So, server’s memory will be management by JVM (Xms, XMX high).
Did you check tcp_tw_recycle with high volume of users from different networks (NAT/proxy)?
Hasta luego
Thanks for the tips Ismael, I haven’t check those properties but I will do!