Avatar

Tuấn Nguyễn


54 साल

की तैनाती: 4 साल
OpenLiteSpeed sử dụng giao diện cài đặt trực quan. Thiết lập chủ yếu nằm ở mục Server Configuration và các tab con bên trong nó.

Mặc đinh, những thiết lập của OLS khá tốt cho mọi nhu cầu, nhưng nếu bạn muốn có hiệu năng tốt hơn, hãy điều chỉnh nó một chút để phù hợp hơn với hệ thống.

Dưới đây, mình xin đưa ra một số tinh chỉnh thông thường cho OLS. Mọi đều ở đây chỉ là mẫu, hãy chỉnh lại phù hợp với máy chủ của bạn.

Cấu hình Server:

4 x 3,4GHz Xeon Core
2GB RAM
Vị trí: LA – USA


Nếu thắc mắc về chức năng của tùy chọn, hãy nhấn vào nút ? cạnh tên chức năng, thông tin về nó sẽ hiện ra (tiếng anh)

General – Tuning
Hướng dẫn tối ưu cài đặt của OpenLiteSpeed - 1

Number of Workers
Tùy chọn nhập: Số thật

Đây là số lượng tiến trình (Worker Process) mà OLS sẽ sử dụng. Mặc định là 1, giới hạn tối đa là 16. Mỗi tiến trình có thể sẽ sử dụng 100% của 1 CPU core để hoạt động. Bạn có thể thiết lập nó bằng tổng số core đang có trên VPS, nhưng mình vẫn khuyên là giữ trống 1 phần cho các tiến trình của PHP hay MySQL. Hoặc để yên 1 cũng được vì OLS rất nhẹ và nhanh khi xử lý HTTP Request.

Memory I/O Buffer
Tùy chọn nhập: Số thật

Đây là lượng bộ nhớ tối đa dùng để chứa nội dung tạm cho các truy vấn hay các nội dung động. Một khi đã sử dụng hết lượng bộ nhớ này, OLS sẽ bắt đầu sử dụng “Swapping Directory” – Chậm hơn, IOP thấp hơn > giảm hiệu năng

Use Client IP in header
Tùy chọn nhập: Chọn 1 trong các mục

Nếu đang sử dụng các loại proxy bất kì như Varnish Cache, Haproxy hay ngay cả Cloudflare hoặc các proxy Anti-DDOS thì bạn sẽ cần kích hoạt tùy chọn này để có thể lấy được IP thật của người dùng, tránh trường hợp tự block chính mình hay dải IP của Cloudflare bị block khiến mọi người không truy cập được.

Index files
Tùy chọn tên file và thứ tự của Index, như Index.html, index.php, defaults.html….

Smart Keep-Alive
Nếu Max Keep-Alive Requests có giá trị lớn hơn 1 (bật Keep-Alive) thì Smart Keep-Alive có thể kích hoạt, Giúp giữ kết nối (keep-alive) với các kết nối đến file CSS, JS, Ảnh, Video…. còn tắt keep-alive đổi với các kết nối đến trang html. Vì sẽ tốt hơn nếu giữ 1 kết nối keep-alive cho những file tĩnh (khá nhiều) và một kết nối không bật keep-alive cho các dữ liệu văn bản,html (chỉ có 1 file) – Tránh trường hợp để kết nối chờ cho đến khi hết Keep-Alive Timeout.

I/O Event Dispatcher
Tùy hệ thống mà chọn thôi, Nếu dùng kernel trên 2.6 (dùng uname -r để biết) thì có thể chọn epoll.

Max Cached Small File Size và Total Small File Cache Size
Những file tĩnh có dung lượng nhro hơn Max Cached Small File Size sẽ được lưu trữ ở memory buffer cache. Và tổng dung lượng sẽ không vược quá Total Small File Cache Size.

Còn file lớn sẽ chứa ở NMAP.

Extarnel APP
Hướng dẫn tối ưu cài đặt của OpenLiteSpeed - 2

External APP > lsphp71 > Max Idle Time
Giữ giá trị ở -1 hoặc để trống nếu sử dụng Opcache. Server có thể lấy lại lượng tài nguyên nếu cần thiết nên không phải quá quan tâm về việc nó sống lâu quá.

External APP > lsphp71 > Memory Soft & Hard Limit
Opcache sẽ sử dụng lượng bộ nhớ được cấp tối đa cho PHP để chứa dữ liệu. Nhưng nếu PHP cần lượng bộ nhớ + bộ nhớ cho Opache lớn hơn giới hạn, thì nó sẽ gây lỗi 503/out of memory.

Nhớ chỉnh thêm ở memory_limit trong file php.ini cho phù hợp nữa

External APP > lsphp71 > Process Soft & Hard Limit
Giới hạn tổng số tiến trình có thể được tạo ra khi hoạt động.

Một số giá trị tinh chỉnh mẫu
Mình đưa ra một số giá trị mẫu để tham khảo. Ở phần Worker Process, sử dụng công thức [tổng số core]/2 để tính toán sử dụng.

General
Number of Workers: 2

Memory I/O Buffer : 120M

Index Files: index.html index.php

Tuning
I/O Event Dispatcher: epoll (Linux kẻnel 2.6+)

Default SHM Directory: /dev/shm

Smart Keep-Alive: Yes

Send Buffer Size (bytes): 65535

Receive Buffer Size (bytes): 65535

Max Cached Small File Size (bytes): 16384

Total Small File Cache Size (bytes): 40M

Max MMAP File Size (bytes): 512K

Total MMAP Cache Size (bytes): 80M

External App
Max Connections: 50

Environment :

PHP_LSAPI_MAX_REQUESTS=5000
PHP_LSAPI_CHILDREN=50
Memory Soft Limit (bytes): 2047M

Memory Hard Limit (bytes): 2047M

Process Soft Limit: 1000

Process Hard Limit: 1500
मेरी टाइमलाइन पर शेयर करें

pityaffinity electricdriver में शामिल हो गए: 34 में

की तैनाती: 34 में
While researching this fascinating issue, I've picked up a wealth of knowledge. fireboy and watergirl

Victor Patrick में शामिल हो गए: 34 में

की तैनाती: 34 में
Number of Workers: Set the number of worker processes based on the available CPU cores, considering a balance between OLS, PHP, and MySQL processes. Dave The Diver

loinse bekean में शामिल हो गए: 48 में

की तैनाती: 32 में
wordle is a free daily word game that can teach you a lot of new words. It's entertaining, straightforward, and limited to one game each day, just like a crossword puzzle. There is a new word of the day that you must identify every day for the next twenty-four hours.

Oren Andree में शामिल हो गए: 45 में

की तैनाती: 30 में
One of the standout features of subway surfers online is its ability to constantly update with new locations, characters, and challenges, ensuring that players always have something new to explore.

Pima He में शामिल हो गए: 1 यू

की तैनाती: 26 में
Pokemon fusion is a fan-made concept that combines two or more Pokemon to create a new, hybrid creature. Fans use online tools and software to create their own unique fusions and share them with others in the community.

Victor Patrick में शामिल हो गए: 34 में

की तैनाती: 25 में
Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. tunnel rush

Lily Collins में शामिल हो गए: 1 यू

की तैनाती: 21 में
The plot of fnaf revolves around a security guard hired to work at a pizza restaurant called Freddy Fazbear's Pizza at night. The player must try to survive five nights working inside while avoiding attacks by bear robots and automated pizzas, which they call "animatronics". The plot later evolved and expanded through subsequent installments of the game series.

Helen Dam में शामिल हो गए: 6 में

की तैनाती: 6 में
Geometry Dash Soundtrack Evolution: Witness the evolution of the Geometry Dash soundtrack. As the game updates, so does the music, providing a fresh auditory experience with each new level.

Vicente Bruen में शामिल हो गए: 4 में

की तैनाती: 1 डी
It is important to note that creating feminized seeds https://pureplantpleasures.com requires expertise and careful control of the breeding process. This method has become popular among growers as it ensures a higher success rate in producing female plants, saving time, space, and resources that would otherwise be spent on cultivating and identifying male plants.