Rigel Kentaurus
Well-known member
When I read on the release notes that XenForo that we were getting templates as files ...
http://xenforo.com/community/threads/xenforo-1-1-0-beta-3-released.21678/#post-274157
I got excited. Finally. Would this mean the end for eval() .. plus, speed would probably increase. Then I started thinking .. should I be excited ?
So, I decided to throw in a benchmark. Let's jump to the results, and then I'll talk about the process.
The results
For the test environment that was used

The objective
The objective of the test is measuring if, for the same set of data, in an isolated environment, loading the templates from files represents a change from loading them from the database, and measuring that by looking at load times.
The test consisted of loading several pages repeatedly, and measuring the load time for said pages, then changing to templates into files, and repeating the identical, same experiment, and measuring the load time.
The load time is considered from when the request is made until the last byte comes in.
The process
Hardware used
Intel Core 2 Duo CPU, 2.53 Ghz
4 GB DDR3 RAM
SATA hard drive 5400
Software used
CentOS Linux 5.6
PHP 5.3.6 with APC enabled
Mysql 5.5.9 Community
Apache 2.2
The XenForo installation
XenForo 1.1 beta 3 with
18,000 threads
300,000 posts
13,000 users
The machine is isolated from user access, it is a test environment, only the test engine has access to that. The test consisted of the following
Loading the home page, opening a forum, opening a thread, browsing a user profile
This test was simulated for 10 online active users, each of them doing the experiment for 10 times. This means that the sample data was taken from loading 10 X 15 times the home page (150 times)
Everything was in the same machine, there is no network traffic.
The pages were "warmed". This means, the experiment was run once to make sure any caches are set, the opcode optimizations were initialized and that the subsequent loads do not represent a "first load" experience that could add any bias to the sample.
The data shown in the tables is from the second experiment. The test was repeated 3 more times to measure if the results could be attributed to other conditions. All the subsequent tests render similar proportions of 4%
The details
These are the details for the test. From there you can read that, for example, the Home Page went from a best scenario of 292 ms to 230 ms, and from an average of 1259 to 1144
The throughput of the server was increased by roughly 0.1%, which means that you would be able to serve 0.1% more requests with this change.
Templates from database

Templates from files

Conclusion
Templates in files will give you a small performance increase, it is faster. "How much" will depend on your exact server setup.
If you are looking to squeeze the last bit of performance from your server this feature would be useful. It can't hurt and the only reason not to enable it is if you are short of disk space, you don't have APC anyway or you are finding a bug by using templates in files.
If you are looking to improve your server performance because you are already in trouble this will do you no good. If your pages are slow this will only make them less slow, not fast. For that, it is way better to just upgrade to a better server or profile the actual performance bottleneck.
The fact that this was added to XenForo proves the level of detail and attention that is put into the software. Few people will care about optimizing that last 0.1%
http://xenforo.com/community/threads/xenforo-1-1-0-beta-3-released.21678/#post-274157
I got excited. Finally. Would this mean the end for eval() .. plus, speed would probably increase. Then I started thinking .. should I be excited ?
So, I decided to throw in a benchmark. Let's jump to the results, and then I'll talk about the process.
The results
For the test environment that was used

The objective
The objective of the test is measuring if, for the same set of data, in an isolated environment, loading the templates from files represents a change from loading them from the database, and measuring that by looking at load times.
The test consisted of loading several pages repeatedly, and measuring the load time for said pages, then changing to templates into files, and repeating the identical, same experiment, and measuring the load time.
The load time is considered from when the request is made until the last byte comes in.
The process
Hardware used
Intel Core 2 Duo CPU, 2.53 Ghz
4 GB DDR3 RAM
SATA hard drive 5400
Software used
CentOS Linux 5.6
PHP 5.3.6 with APC enabled
Mysql 5.5.9 Community
Apache 2.2
The XenForo installation
XenForo 1.1 beta 3 with
18,000 threads
300,000 posts
13,000 users
The machine is isolated from user access, it is a test environment, only the test engine has access to that. The test consisted of the following
Loading the home page, opening a forum, opening a thread, browsing a user profile
This test was simulated for 10 online active users, each of them doing the experiment for 10 times. This means that the sample data was taken from loading 10 X 15 times the home page (150 times)
Everything was in the same machine, there is no network traffic.
The pages were "warmed". This means, the experiment was run once to make sure any caches are set, the opcode optimizations were initialized and that the subsequent loads do not represent a "first load" experience that could add any bias to the sample.
The data shown in the tables is from the second experiment. The test was repeated 3 more times to measure if the results could be attributed to other conditions. All the subsequent tests render similar proportions of 4%
The details
These are the details for the test. From there you can read that, for example, the Home Page went from a best scenario of 292 ms to 230 ms, and from an average of 1259 to 1144
The throughput of the server was increased by roughly 0.1%, which means that you would be able to serve 0.1% more requests with this change.
Templates from database

Templates from files

Conclusion
Templates in files will give you a small performance increase, it is faster. "How much" will depend on your exact server setup.
If you are looking to squeeze the last bit of performance from your server this feature would be useful. It can't hurt and the only reason not to enable it is if you are short of disk space, you don't have APC anyway or you are finding a bug by using templates in files.
If you are looking to improve your server performance because you are already in trouble this will do you no good. If your pages are slow this will only make them less slow, not fast. For that, it is way better to just upgrade to a better server or profile the actual performance bottleneck.
The fact that this was added to XenForo proves the level of detail and attention that is put into the software. Few people will care about optimizing that last 0.1%