tailieunhanh - Pro PHP Application Performance Tuning PHP Web Projects for Maximum Performance phần 6

Điểm chuẩn thực hiện đầy đủ bằng cách sử dụng lệnh ab được hiển thị trong Ví dụ 5-5, một lần nữa kết quả được thể hiện trong hình 5-6. ab kết quả cho Liệt kê mã 5-7 Thêm logic đầy đủ các ứng dụng mẫu chúng tôi sẽ được sử dụng làm giảm tổng số yêu cầu mỗi thứ hai với 73,46, | CHAPTER 5 VARIABLE CACHING statement SELECT num FROM chapters ORDER BY num DESC results mysql_query statement dbHandler or die Could not run SQL .mysql_error dbHandler Close connection. mysql_close dbHandler Add to collection records array while record mysql_fetch_object results records record- num Display table table border 1 tr td Array Elements td tr foreach records as record table . tr td record td tr table . table echo table Benchmarking the full implementation using the ab command shown in Listing 5-5 once again the results are shown in Figure 5-6. 118 CHAPTER 5 VARIABLE CACHING Document Path Chapter5 Document Length 238932 bytes Concurrency Level 5 Time taken for tests seconds Complete requests 1000 Failed requests 0 Write errors 0 Total transferred 239123000 bytes HTML transferred 238932000 bytes Requests per second sec mean Time per request ms mean Time per request ms mean across all concurrent requests Transfer rate Kbytes sec received Connection Times ms min mean -sd median max Connect e 0 e 4 Processing 26 68 66 136 Waiting 24 62 59 123 Total 26 68 66 136 Figure 5-6. ab results for Listing 5-7 code Adding the full logic to the sample application we ll be using reduces the total number of requests per second to and a request is satisfied in . Not a very ideal set of numbers that s a 65 percent decrease in total requests per second and a 184 percent increase to satisfy a single request. Let s go ahead and use APC to improve these numbers. APC Caching In Chapter 4 we implemented APC to exclusively cache PHP Opcode. In this chapter we will use APC to store information. To do so we re going to focus on a subset of internal PHP APC methods shown in Table 5-1. Before we begin make sure you have the APC PHP extension fully installed. The complete steps to install APC are shown in Chapter 4. Table 5-1. APC Functions Function Parameters Description apc_add apc_add String key .

TỪ KHÓA LIÊN QUAN