]> git.mxchange.org Git - friendica.git/blob - mods/performance-improvements.txt
Some performance instructions
[friendica.git] / mods / performance-improvements.txt
1 A little guide to increase the performance of a friendica site
2 **************************************************************
3
4 At first
5 ========
6
7 Feel freee to ask the friendica support at 
8 <https://helpers.pyxis.uberspace.de/profile/helpers> if you need some 
9 clarification about the following instruction or if you need help in any 
10 other way.
11
12 System configuration
13 ====================
14
15 Please go to /admin/site/ on your system and change the following values:
16
17 * Set "JPEG image quality" to 50. 
18
19 This value reduces the data that is send from the server to the client. 
20 50 is a value that doesn't influences image qualitity too much.
21
22 * Set "OStatus conversation completion interval" to "never".
23
24 if you are having many OStatus contacts then completing of conversations 
25 can be very time wasting. The downside: You won't see any answer in 
26 OStatus conversations.
27
28 * Set "Path for lock file" to an empty folder outside your web root.
29
30 Lock files help avoiding the situation that several background processes 
31 run at the same time. 
32
33 For example: It can happen the the poller.php is working longer than 
34 expected. When there would be no lock file than maybe several instances 
35 of poller.php would run at the same time - which would slow down the 
36 systen and would affect the maximum numbers of processes and database 
37 conenctions.
38
39 Please define a full file path that is writeable by the web server 
40 process. If your site would be located at "/var/www/sitename/htdocs/" 
41 you maybe could create a folder "/var/www/sitename/temp/".
42
43 * Enable "Use MySQL full text engine"
44
45 When using MyISAM (default) this speeds up the search.
46
47 * Set "Path to item cache" to an empty value outside your web root.
48
49 Parsed BBCode and some external images will be put there. Parsing BBCode 
50 is a timewasting process that also uses much CPU speed.
51
52 You can use the same folder like you used for the lock file.
53
54 ---------
55 !Warning!
56 ---------
57
58 The folder for the item cache is cleaned up regularly. Every file that 
59 exceedes the cache duration is deleted. If you accidently would point 
60 the cache path to your web root then you would delete your webroot!
61
62 So ensure twice that the folder only contains temporary content that can 
63 be deleted at any time.
64
65 You have been warned.
66
67 P.S. It happened to me :)
68
69 Plugins
70 =======
71
72 Active the following plugins:
73 * Alternate Pagination
74 * Privacy Image Cache
75 * rendertime
76
77 Alternate Pagination
78 --------------------
79
80 Description:
81
82 This plugin reduces the database load massively. Downside: You can't see 
83 anymore the number of pages.
84
85 Administration:
86
87 Go to the admin settings of "altpager" and set it to "global". 
88
89 Privacy Image Cache
90 -------------------
91
92 Description:
93
94 This plugin is prefetching external content and stores it into the 
95 cache. Besides speeding up the page rendering it is also good for 
96 keeping the privacy of your users, since embedded pictures would be 
97 loaded from your site and not from a foreign site (that could spy on the 
98 IP addresses).
99
100 Additionally it helps with content from external sites that are having a 
101 slow performance or that are aren't online all the time.
102
103 Administration:
104
105 Please create a folder named "privacy_image_cache" and "photo" in 
106 your web root. If these folders exists then the cached files will be 
107 stored there. This has the great advantage that your webserver will 
108 fetch the files directly from there. 
109
110 rendertime
111 ----------
112
113 This plugin doesn't speed up your system. It helps analysing your 
114 bottlenecks.
115
116 When enabled you see some values like the following at the bottom of 
117 every page:
118
119 Performance: Database: 0.244, Network: 0.002, Rendering: 0.044, Parser: 0.001, I/O: 0.021, Other: 0.237, Total: 0.548
120
121 * Database: This is the time for all database queries
122 * Network: Time that is needed to fetch content from external sites
123 * Rendering: Time for theme rendering
124 * Parser: The time that the BBCode parser needed to create the output
125 * I/O: Time for local file access
126 * Others: Everything else :)
127 * Total: The sum of all above values
128
129 These values are showing your performance problems. 
130
131 Webserver
132 =========
133
134 If you are using apache pease enable the following modules.
135
136 Cache-Control
137 -------------
138
139 This module tells the client to cache the content of static files so 
140 that they aren't fetched with every request.
141
142 Enable the module "mod_expires" by typing in "a2enmod expires" as root.
143
144 Please add the following lines to your site config in the "directory" 
145 context.
146
147 <IfModule mod_expires.c>
148   ExpiresActive on
149   ExpiresDefault "access plus 1 week"
150 </IfModule>
151
152 See also: http://httpd.apache.org/docs/2.2/mod/mod_expires.html
153
154 Compress content
155 ----------------
156
157 This module compresses the traffic between the webserver and the client.
158
159 Enable the module "mod_deflate" by typing in "a2enmod deflate" as root.
160
161 See also: http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
162
163 PHP
164 ===
165
166 FCGI
167 ----
168
169 When using apache think about using FCGI. When using a Debian based 
170 distribution you will need the packages named "php5-cgi" and " 
171 libapache2-mod-fcgid".
172
173 Please refer to external documentations for a more detaillied 
174 explanation how to set up a system based upon FCGI.
175
176 APC
177 ---
178
179 APC is an opcode cache. It speeds up the processing of PHP code. 
180
181 When APC is enabled, friendica uses it to store configuration data 
182 between different requests. This helps speeding up the page creation 
183 time.
184
185 Database
186 ========
187
188 There are scripts like tuning-primer.sh <http://www.day32.com/MySQL/> 
189 and mysqltuner.pl <http://mysqltuner.pl> that analyse your database 
190 server and that are giving hints on values that could be changed.
191
192 Please enable the slow query log. This helps being aware of performance 
193 problems.