Thoughts on LAMP: Performance Optimization Summary

Source: Internet
Author: User

Thoughts on LAMP: Performance Optimization Summary
Article 1: I am very low and write a lot of things. My predecessors have summarized various things. so, you can just record them all at once.
I just inadvertently checked the message about php acceleration and saw a saying "the bottleneck of lamp structure lies in M". I feel that it is a real sensation. Of course, this is an ideal situation. In actual production environments, there are a variety of problems to be solved. The optimization points of l-a-m-p in different stages are different, although the final bottleneck of efforts lies in M, various efforts during the period cannot be ignored. Next I will summarize the various problems encountered in the website production environment.
The following is a summary of previous problems:
1. SQL code performance problems in php
This exists in two aspects. One is that the SQL itself is not optimized enough. The other is that some performance problems will gradually be exposed as the data volume increases.

2. memory consumption caused by apache processing mode
Because apache processes http requests in the form of processes in synchronous blocking mode, so, when the webpage itself loads too many elements, it will cause a large number
Http Process concurrency consumes a large amount of memory on the server, resulting in slow access or exceptions.
The solution is very simple, mainly including several aspects
A. convert a dynamic page to a static page.
B. Convert to lnamp mode. Static resources such as images are processed by nginx to reduce the number of http processes.

3. Use of CDN service
This is not a performance issue, but to solve the problem of page loading speed and latency between different networks.
The specific use effect is very good, it will greatly improve the access speed of users in various regions, local companies can build their own CDN, small and medium companies
Choosing a third-party service is also a good choice.

4. Cache Usage
There are two aspects of the cache, the main cache is the data, that is, the dynamic cache.
The main software used are redis and memcache (open-source)
Both software caches requests between php and mysql to reduce direct interaction with mysql and improve access speed.

5. apache load balancing and mysql read/write splitting
Even if CDN and cache are added and apache pages are optimized, the high concurrency problem still gradually emerges as the number of users increases.
Big moves are coming soon. Expand it! Rong! Hard! !. It will always take effect when used up. We are mainly using nginx + apache load balancing.
Mysql's read/write splitting is also easy. You can use master-slave replication. It is not a big problem to access webpages that are not too timely.

6. Strange issues are crude !!!
Then, the optimized users have been optimized, and the experience of their predecessors is also a reference. Finally, they found that page access is still slow and users want to log out. Where is the problem?
After an arduous investigation and research, I finally found that a permission system opened by a former buddy (used for loading all webpages) was not closed.
Debug, I will go! My old blood sprayed on the monitor! Heaven, I once doubted whether I was doing useless work!

This is not to provoke class conflicts between O & M and R & D, but to sum up experience and lessons, so we will not take a detour in the future!
Come here first! I will try again later!






Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.