Skip to content

Instantly share code, notes, and snippets.

@chicks
Last active February 8, 2021 13:33
Show Gist options
  • Save chicks/8927971 to your computer and use it in GitHub Desktop.
Save chicks/8927971 to your computer and use it in GitHub Desktop.
SugarCRM Performance Tweaks
httpd.conf
--- ./orig-cfgs/httpd.conf
2014-02-10 13:25:05.930008746 -0500
+++ /etc/httpd/conf/httpd.conf
2014-02-10 16:56:25.370008744 -0500
@@ -71,11 +71,11 @@
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
-KeepAlive Off
+KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
@@ -84,11 +84,11 @@
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
-KeepAliveTimeout 15
+KeepAliveTimeout 2
##
## Server-Pool Size Regulation (MPM specific)
##
@@ -98,13 +98,13 @@
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
-StartServers 8
-MinSpareServers 5
-MaxSpareServers 20
+StartServers 16
+MinSpareServers 4
+MaxSpareServers 16
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
@@ -223,11 +223,11 @@
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
-#ExtendedStatus On
+ExtendedStatus On
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
@@ -916,16 +916,16 @@
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
-#<Location /server-status>
-# SetHandler server-status
-# Order deny,allow
-# Deny from all
-# Allow from .example.com
-#</Location>
+<Location /server-status>
+ SetHandler server-status
+ Order allow,deny
+ Allow from all
+ Deny from .example.com
+</Location>
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
--- ./orig-cfgs/my.cnf
2014-02-10 13:44:50.590008749 -0500
+++ /etc/my.cnf
2014-02-10 20:34:51.260008746 -0500
@@ -3,8 +3,23 @@
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
+datadir=/data/mysql
+
+query-cache-type = 1
+query-cache-size = 32000000
+
+innodb_buffer_pool_size = 137438953472
+innodb_file_per_table
+
+log-error = /data/logs/mysql/error.log
+
+long-query-time = 0
+slow-query-log = 1
+slow-query-log-file = /data/logs/mysql/queries.log
+
+tmpdir = /data/temp
+
[mysqld_safe]
-log-error=/var/log/mysqld.log
-pid-file=/var/run/mysqld/mysqld.pid
+pid-file = /var/run/mysqld/mysqld.pid
--- ./orig-cfgs/php.ini 2014-02-10 20:58:51.440008745 -0500
+++ /etc/php.ini 2014-02-10 18:06:43.080008744 -0500
@@ -1237,11 +1237,11 @@
;browscap = extra/browscap.ini
[Session]
; Handler used to store/retrieve data.
; http://www.php.net/manual/en/session.configuration.php#ini.session.save-handler
-session.save_handler = file
+session.save_handler = memcache
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
@@ -1266,11 +1266,11 @@
; session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://www.php.net/manual/en/session.configuration.php#ini.session.save-path
-session.save_path = /var/lib/php/session
+session.save_path = "tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
; Whether to use cookies.
; http://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
session.use_cookies = 1
Apache:
- Activated 'KeepAlive' connections
- Lowered keep alive timeout from 15 seconds to 2 seconds
- Increased the number of minimum workers from 8 to 16
- Activated server status page (/server-status)
APC (Alternative PHP Cache):
- Set cache size to 256MB (ideal for SugarCRM workload)
Memcache:
- Setup to use as PHP session store (allows sessions to be stored in memory, opposed to on disk)
- Disabled memcache opscode caching in config_override.php in SugarCRM (forcing the use of APC for opscode caching)
MySQL:
- Installed Percona 5.5 (performance tuned version of MySQL)
- Activated a query cache of 32MB (cache commonly executed query results)
- Activated an InnoDB buffer pool of 128GB (allows complete data set to be held in memory)
- Made a 2GB memory disk for Percona to use as a temporary dir (/data/temp... writes to memory disk for temporary tables as opposed to disk)
- Changed table type for SugarCRM tables from MyISAM to InnoDB/XtraDB and moved each table to individual file (vast performance gains b/c of more efficient file format)
- Logging all queries for offline performance analysis using pt-query-digest (/data/logs/mysql/queries.log)
Disk:
- Built 16 spindle software RAID-0 array for highest performance (/data)
- Assigned a single spindle to offload logging writes (/data/logs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment