MySQL có lẽ lưu kết quả của một truy vấn trong bộ nhớ
mới cache riêng của nó. Để kích hoạt nó biên tập các tập
được tin cấu hình MySQL (thường /etc/my.cnf) và thêm
sẽ những dòng này: query_cache_type = 1 query_cache_limit
nhất = 1M query_cache_size = 16M
hợp lý vps
Toi uu vps
Để đánh giá xem nó chính
dễ xác là chạy và toi uu vps, chạy truy vấn này:
SHOW STATUS đừng LIKE ‘Qcache%’;
Kết quả:
Qcache_free_blocks |
718 được |
Qcache_free_memory |
13004008 |
Qcache_hits |
780759 đừng |
Qcache_inserts |
56292 |
Qcache_lowmem_prunes |
0 đang |
Qcache_not_cached |
3711 |
Qcache_queries_in_cache đã |
1715 |
Qcache_total_blocks |
4344 |
Cách hợp lý vps
Hơn nữa MySQL hợp
nhanh lý hóa với cách hợp lý vps: Có rất nhiều tùy chọn, bạn
thường có lẽ chơi với giống như vậy ở đây là tập tin cấu hình
chớ MySQL của tôi thay vào đó, điều chỉnh trong hosting
đang giá phải chăng 4GB, quad-core máy chuyên dụng. Cách
chớ hợp lý vps điều này có lẽ sẽ không làm việc cho đa số
nhất các máy tính của bạn ra khỏi hộp, tiêu dùng nó giống
dễ như một có các hướng dẫn chung.
[mysqld] bulk_insert_buffer_size đừng = 8M connect_timeout=10 interactive_timeout=50 luôn join_buffer=1M key_buffer=250M max_allowed_packet=16M đừng max_connect_errors=10 max_connections=100 chớ max_heap_table_size = 32M myisam_sort_buffer_size=96M không thể query_cache_limit = 4M query_cache_size = 250M đột nhiên query_cache_type = 1 query_prealloc_size = 65K có thể query_alloc_block_size = 128K read_buffer_size=1M dễ read_rnd_buffer_size=768K record_buffer=1M dễ safe-show-database skip-innodb skip-locking nhất skip-networking sort_buffer=1M table_cache=4096 nhanh thread_cache_size=1024 thread_concurrency=8 đã tmp_table_size = 32M wait_timeout=500 # for slow cũng queries, comment when not used #log-slow-queries=/var/log/mysql-slow đã .log #long_query_time=1 #log-queries-not-using-indexes thôi [mysqld_safe] nice = -5 open_files_limit = rất quan trọng vẫn 8192 [mysqldump] quick max_allowed_packet = 16M vẫn [myisamchk] key_buffer = 64M sort_buffer = 64M cả read_buffer = 16M write_buffer = 16M
PHP Opcode Cache
phpize ./configure thôi make make install
Điều này sẽ cài đặt eAccelerator rất . Tiếp theo, tạo thư mục tạm để lưu trữ:
mkdir /var/cache/eaccelerator cả chmod 0777 /var/cache/eaccelerator
Finally to nhanh enable it, add these lines to the end of your php. cũ ini file (usually /etc/php.ini or /usr/lib/php.ini):
extension=”eaccelerator được .so” eaccelerator.shm_size=”16″ eaccelerator lắm .cache_dir=”/var/cache/eaccelerator” eaccelerator thôi .enable=”1″ eaccelerator.optimizer=”1″ eaccelerator nhất .check_mtime=”1″ eaccelerator.debug=”0″ eaccelerator đang .filter=”” eaccelerator.shm_max=”0″ eaccelerator rất .shm_ttl=”0″ eaccelerator.shm_prune_period=”0″ quá eaccelerator.shm_only=”0″ eaccelerator.compress=”1″ rất eaccelerator.compress_level=”9″
Diệp Toàn Phát (sieutocviet.vn)
Với hơn 5 năm kinh nghiệm thực chiến Python, PHP và 7 năm quản trị website, tôi chuyên tư vấn giải pháp SEO từ khóa, Digital Marketing tối ưu cho doanh nghiệp. Hiện là trưởng phòng kinh doanh tại Siêu Tốc Việt.