]> git.mxchange.org Git - friendica.git/blob - doc/Improve-Performance.md
Merge remote-tracking branch 'upstream/develop' into 1508-public-relay
[friendica.git] / doc / Improve-Performance.md
1 How to improve the performance of a Friendica site
2 ==============
3
4 * [Home](help)
5
6 Feel free to ask in the [Friendica support forum](https://helpers.pyxis.uberspace.de/profile/helpers) if you need some clarification about the following instructions or if you need help in any other way.
7
8 System configuration
9 --------
10
11 Please go to /admin/site/ on your system and change the following values:
12
13     Set "JPEG image quality" to 50.
14
15 This value reduces the data that is send from the server to the client. 50 is a value that doesn't influences image quality too much.
16
17     Set "OStatus conversation completion interval" to "never".
18
19 If you have many OStatus contacts then completing of conversations can be very time wasting. The downside: You won't see every comment in OStatus threads.
20
21     Set "Path for lock file" to an empty folder outside your web root.
22
23 Lock files help avoid the possibility of several background processes running at the same time.
24
25 For example: It can happen that the poller.php takes longer than expected.
26 When there is no lock file, it is possible for several instances of poller.php to run at the same time - which would slow down the system and affect the maximum numbers of processes and database connections.
27
28 Please define a full file path that is writeable by the web server process.
29 If your site is located at "/var/www/sitename/htdocs/" you could maybe create a folder "/var/www/sitename/temp/".
30
31     Enable "Use MySQL full text engine"
32
33 When using MyISAM (default) this speeds up search.
34
35     Set "Path to item cache" to an empty value outside your web root.
36
37 Parsed BBCode and some external images will be put there.
38 Parsing BBCode is a time wasting process that also makes heave use of the CPU.
39 You can use the same folder you used for the lock file.
40
41 **Warning!**
42
43 The folder for item cache is cleaned up regularly.
44 Every file that exceeds the cache duration is deleted. **If you accidentally point the cache path to your web root then you will delete your web root!**
45 So double check that the folder only contains temporary content that can be deleted at any time.
46 You have been warned.
47
48 Plugins
49 --------
50
51 Active the following plugins:
52
53     Alternate Pagination
54     Privacy Image Cache
55     rendertime
56
57 ###Alternate Pagination
58
59 This plugin reduces the database load massively.
60 Downside: You can't see the total number of pages available at each module, and have this replaced with "older" and "newer" links.
61
62 Go to the admin settings of "altpager" and set it to "global".
63
64 ###rendertime
65
66 This plugin doesn't speed up your system. 
67 It helps to analyze your bottlenecks.
68
69 When enabled you see some values at the bottom of every page.
70 They show your performance problems.
71
72     Performance: Database: 0.244, Network: 0.002, Rendering: 0.044, Parser: 0.001, I/O: 0.021, Other: 0.237, Total: 0.548
73
74     Database: This is the time for all database queries
75     Network: Time that is needed to fetch content from external sites
76     Rendering: Time for theme rendering
77     Parser: The time that the BBCode parser needed to create the output
78     I/O: Time for local file access
79     Others: Everything else :)
80     Total: The sum of all above values
81
82 Apache Webserver
83 --------
84
85 The following Apache modules are recommended:
86
87 ###Cache-Control
88
89 This module tells the client to cache the content of static files so that they aren't fetched with every request.
90 Enable the module "mod_expires" by typing in "a2enmod expires" as root.
91 Please add the following lines to your site configuration in the "directory" context.
92
93         ExpiresActive on ExpiresDefault "access plus 1 week"
94
95 Also see the Apache [2.2](http://httpd.apache.org/docs/2.2/mod/mod_expires.html) / [2.4](https://httpd.apache.org/docs/2.4/mod/mod_expires.html) documentation.
96
97 ###Compress content
98
99 This module compresses the traffic between the web server and the client.
100 Enable the module "mod_deflate" by typing in "a2enmod deflate" as root.
101
102 Also see the Apache [2.2](http://httpd.apache.org/docs/2.2/mod/mod_deflate.html) / [2.4](https://httpd.apache.org/docs/2.4/mod/mod_deflate.html) documentation.
103
104 PHP
105 --------
106
107 ###FCGI
108
109 When using Apache think about using FCGI.
110 In a Debian-based distribution you will need to install the packages named "php5-cgi" and "libapache2-mod-fcgid".
111
112 Please refer to external documentation for a more detailed explanation how to set up a system based upon FCGI.
113
114 ###APC
115
116 APC is an opcode cache.
117 It speeds up the processing of PHP code.
118 When APC is enabled, Friendica uses it to store configuration data between different requests.
119 This helps speeding up the page creation time.
120
121 ###Database
122
123 There are scripts like [tuning-primer.sh](http://www.day32.com/MySQL/) and [mysqltuner.pl](http://mysqltuner.pl) that analyze your database server and give hints on values that could be changed.
124
125 Please enable the slow query log. This helps to find performance problems.