TAILIEUCHUNG - Tạo mạng xã hội với PHP - part 44

Planning for Growth Code performance One of the most important factors when it comes to the speed, performance, and scalability of our site, is our code. By improving the performance of our code, it consumes fewer resources, allowing us to get more out of our current hardware. Thankfully, because we have used the Model-View-Controller architecture, our code is already maintainable, extendable, and flexible, which is a big advantage, particularly with regards to plugging in new features further down the line. So, what can we do to improve our code performance? • • • We can profile our code to look for problems. | Planning for Growth Code performance One of the most important factors when it comes to the speed performance and scalability of our site is our code. By improving the performance of our code it consumes fewer resources allowing us to get more out of our current hardware. Thankfully because we have used the Model-View-Controller architecture our code is already maintainable extendable and flexible which is a big advantage particularly with regards to plugging in new features further down the line. So what can we do to improve our code performance We can profile our code to look for problems We can look for slow MySQL queries that we can optimize We can compress our output Code profiling We can profile our code to find bottlenecks in our code so that we know which aspects need improving or refactoring. Profiling tools such as xdebug http are integrated into PHP to run as our scripts run logging performance information to a file which we can analyze using another suitable tool with xdebug we can use tools such as KCacheGrind or WinCacheGrind . Slow queries MySQL can be configured to log slow queries so that we can see which queries are taking too long to run so that we can investigate them improve the queries or improve the database scheme itself that is by adding more suitable indexes. To enable the slow query log we simply add the following line to our MySQL configuration file file log-slow-queries Once enabled the query log by default logs queries that take longer than 10 seconds to complete we can change this by adding the following line to our configuration file set-variable long_query_time 2 412 Download from Chapter 14 Compression By compressing our website s output we can reduce network latency between the server and the user and reduce bandwidth usage making the site load faster. While the code won t be generated any quicker it should be received by the user faster. This can be done .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.