File: PERFORMANCE

package info (click to toggle)
horde3 3.1.3-4etch7
  • links: PTS
  • area: main
  • in suites: etch
  • size: 22,876 kB
  • ctags: 18,071
  • sloc: php: 75,151; xml: 2,979; sql: 1,069; makefile: 79; sh: 64
file content (185 lines) | stat: -rw-r--r-- 6,746 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
=========================
 Horde Performance Guide
=========================

:Last update:   $Date: 2006/05/31 19:14:14 $
:Revision:      $Revision: 1.9.10.13 $
:Contact:       horde@lists.horde.org

.. contents:: Contents


Some tips on performance tuning systems for Horde.  This does not cover
hardware tuning or even low level system (network, filesystem, etc) tuning.

Don't apply the following tuning hints blindly.  Test your applications before
and after the changes under the conditions that are important for you.  For
some people it's more important to make them as fast as possible for a small
user base, others require the applications to scale well under a high load.
Some of these hints might even make the applications slower under certain
conditions or using a certain hardware.


Linux Tuning
============

* Recompile RPMS for your architecture (e.g. i586, i686, athlon, etc).
  This applies most to your Apache, PHP, IMAP, and POP3 packages.


Apache/PHP tuning
=================

* Consider a PHP accelerator program.  See for example `The Zend Performance
  Suite`_, The `ionCube PHP Accelerator`_, `Turck MMCache for PHP`_, or
  eAccelerator_.  These accelerators speed up access by caching the compiled
  PHP code, eliminating the need to recompile the code for every single page
  load.  **This is probably the easiest way to improve the performance of
  Horde**.  If using Turck MMCache, **PLEASE** read `Turck MMCache
  Troubleshooting`_.

* Compile PHP with the ``--enable-inline-optimization`` option to generate the
  fastest possible PHP executable.

* Use of the mcrypt PHP extension should significantly increase performance
  while also increasing security.

* Enable PHP output compression (either in ``php.ini`` or
  ``horde/config/conf.php``).

* Disable the memory limit in ``php.ini``.

* Keep the include path defined in ``php.ini`` as short as possible, with the
  most frequently used library paths first.  You don't need to include the
  local directory ``.`` because Horde always uses full paths instead of
  relative paths.

* Use an optimized ``php.ini``, start from ``php.ini-recommended`` of your PHP
  dsitribution.

* Don't run PHP session garbage collection too often if using a slow storage
  medium (like SQL). (See ``session.gc_probability`` in ``php.ini``)

* If you have a large number of sessions, consider storing them in hashed
  directory levels. (See ``session.save_path`` at http://www.php.net/session)

* Consider using a faster storage medium for sessions, such as a tmpfs or
  other memory based file system.  If you are sure your apache setup is rock
  solid and you don't restart it there is a mm session driver.  However, be
  aware that certain Horde applications (like IMP) make heavy use of caching
  data in sessions so memory based solutions may be exhausted quickly,
  particularly if there will be more than a single user.

* Only load as many Apache and PHP extensions as needed (to reduce memory
  usage).

* Use statically compiled Apache modules, including the PHP module.

* Use compiler optimizations (--prefer-non-pic, -O3, -march -mcpu, -msse,
  -mmmx, -mfpmath=sse, etc.)

* If using SSL with a large site, consider a hardware SSL accelerator.

* Use shared memory for the Apache SSL cache if possible.

* To improve caching of static content if accessing Apache SSL with Internet
  Explorer, try setting longer expiration periods::

    ExpiresActive On
    ExpiresByType image/png "now plus 1 month"
    ExpiresByType image/gif "now plus 1 month"
    ExpiresByType text/javascript "now plus 1 month"
    ExpiresByType application/x-javascript "now plus 1 month"
    ExpiresByType text/css "now plus 1 month"

  .. Note:: You must compile the ``mod_expires`` extension into Apache in
            order to use these directives.

  .. Warning:: This might cause problems if you upgrade Horde and the users'
               browsers still use the old file versions.

* Disable DNS lookups in your Apache logging, or use a caching DNS server on
  the web server host.

* Enable Apache keepalives.

.. _`The Zend Performance Suite`: http://www.zend.com/horde.php
.. _`ionCube PHP Accelerator`: http://www.php-accelerator.co.uk
.. _`Turck MMCache for PHP`: http://turck-mmcache.sourceforge.net
.. _eAccelerator: http://eaccelerator.net
.. _`Turck MMCache Troubleshooting`: http://wiki.horde.org/TurckMMCacheTroubleshooting


Sending Mail
============

* Generally using a local sendmail command to send mail will result in better
  peformance than using a SMTP connection.

* Some MTA servers may be faster or more efficient than others.  Consider
  switching to a faster format if needed.


IMAP tuning
===========

* Consider an IMAP proxy for more persistent connections.  Some IMAP proxies
  are up-imapproxy_ and Perdition_.  To make sense, the proxy
  should be installed on the server running Horde, and this server needs
  enough CPU power to handle the additional load.

* Some IMAP servers (or IMAP mailbox store formats) perform better than
  others.  Consider switching to a faster format if needed.

* Follow the IMAP servers' performance hints:

  - Cyrus: http://asg.web.cmu.edu/cyrus/download/imapd/install-perf.html

.. _up-imapproxy: http://www.imapproxy.org/
.. _Perdition: http://www.vergenet.net/linux/perdition/


Postgresql tuning
=================

* Do a vacuum command periodically to tune your database

* Increase ``shared_buffers`` and ``sort_mem`` memory settings.

* If web server and database is on the same unix host, use unix sockets
  instead of network connections for database access.


MySQL tuning
============

* If web server and database is on the same unix host, use unix sockets
  instead of network connections for database access.

* Enable mysql query cache if you have sufficient RAM.  Edit your ``my.cnf``
  file and add the following to the ``[mysqld]`` section (change the memory
  size to meet your needs)::

    set-variable = query_cache_size=128M


Horde tuning
============

* You can configure Horde to serve all images and style sheets from a
  different server. This could be a very lightweight server without all the
  overhead for processing PHP files, like lighttpd. You need to set the
  ``themesuri`` parameter in ``config/registry.php`` for all applications and
  copy all ``themes`` directories in the same directory layout to the other
  server.

.. _lighttpd: http://www.lighttpd.net/


Application tuning
==================

* Some applications contain advanced features that might have a certain impact
  on the performance.  These features can usually be turned off in the
  application's configuration and are explicitly described as being a
  performance hit in the configuration web frontend.