After the above two methods, I believe that the performance of your php (as the current mainstream development language) application has been greatly improved. now we should consider the following from another aspect: download speed. If your application is only running in the company, all customers will use 100 Mb/s ethernet to connect to the server. This may not be a problem, but SyntaxHighlighter. after the above two methods, I believe that the performance of your php (as the mainstream development language) application has been greatly improved, now we need to consider another aspect: download speed. If your application is only running in the company, all customers will connect to the server using 100 Mbit/s Ethernet, which may not be a problem, however, if your customers use a slow modem connection, you should consider using the content compression method.
According to the IETF specification, most browsers support
Compression. This means that you can use gzip to compress the web content before sending it to the client's browser. when receiving the content, the browser automatically decompress the data and allows the user to see the original page. Similarly, there are several different ways to compress the content of a web page.
Mod_gzip is a free apache (the most popular WEB server platform for Unix) module provided by Remote Communications (http://www.php (as the mainstream development language) builder.com/columns/www.remotecommunications.com, it can compress static web pages. It works well. you just need to compile it with apache (the most popular WEB server platform on Unix) (or use it as a DSO ). Remotecommunications people say it can also compress dynamic content, including mod_php (as the mainstream development language) and mod_perl. However, I tried it, but it does not seem to work. I learned from the mod_gzip mailing list that this bug will be fixed in the next version (I think it should be 1.3.14.6f ). However, you can still use it to compress static content.
However, we still want to compress dynamic content, so we must find another method. The method is to use class.gzip encode. php (as the mainstream development language) (http://leknor.com/code/), as long as your php (as the mainstream development language) you can compress your page content by calling the php (as the mainstream development language) class at the beginning and end of the script. If the whole site needs such compression, you can call these functions in your php (as the mainstream development language). ini file auto_prepend and auto_append. It works well, but on websites with heavy loads, it obviously brings about a little system overhead. To learn more about how it works, take a look at its class code (you must at least add zlib support when compiling php (as the mainstream development language ). The instructions provided by the author are also very detailed. you can get anything you need to know.
Recently, I have also seen an article about php (as the mainstream development language) output buffer. Php (as the mainstream development language) 4.0.4 introduces a new processing method for output buffering-ob_gzhandler, which has the same role as the class described above, but the difference is that you only need to use your php (as the mainstream development language ). use the following syntax in ini:
Output_handler = ob_gzhandler;
This will activate the output buffer function of php (as the mainstream development language) and compress everything it sends. For some special reason, if you do not want to set it here, you only need to change the default setting (not to compress ), in the source code directory of the php (as the mainstream development language) to be compressed, modify it. htaccess (a favorite of a small website) file. The syntax is as follows:
Php (as the mainstream development language) _ value output_handler ob_gzhandler
... Or call it directly in your php code (as the current mainstream development language), in the following way:
Ob_start ("ob_gzhandler ");
This output buffering method is good and does not bring additional system overhead to the server. I strongly recommend that you use this method. The change can be illustrated in the following example. if the customer uses a 28.8K modem, after this processing, he will think that suddenly it is changed to an ISDN access. Note that Netscape Communicator does not support image compression, so it cannot be displayed. Therefore, unless all your customers use Internet Explorer, you must disable jpeg and gif image compression. Compression of other files should be fine, but I suggest you test it. In particular, browsers use uncommon plug-ins or browsers that are rarely used.
Other useful things...
Zend Technologies's online store was launched in January 24 this year and sells some interesting products related to php (as the mainstream development language. Including the Zend Cache mentioned above, Zend Encoder (in short, it is the php (as the mainstream development language) code compiler, and can generate compiled classes, in this way, you can sell it to customers without worrying about leaking source code. On the web servers that need to run these classes, Zend Encoder Runtime will be used for decoding), Zend Ide (an integrated development environment for php (as the mainstream development language, with a lot of powerful performance), as well as support services for php (as the mainstream development language) developers.
Conclusion
Using the technology mentioned in this article, you can greatly improve the performance of the site, but pay attention to the following points:
1. the bottleneck may not be in php (as the mainstream development language). you need to check every object in the application (such as a database)
2. the performance of a web server is limited. therefore, do not consider that poor performance is the cause of php (as the mainstream development language), or the traffic may be high, your server needs to be upgraded, or you need to consider using the server load balancer system (it will cost a lot)
3. do not think that content compression is not important. in a 100 Mbit/s Lan, your php (as the mainstream development language) applications may have good performance, however, users who use slow modem must be considered.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service