Practical mod_perl-CHAPTER 10:Improving Performance with Shared Memory and Proper Forking

Tham khảo tài liệu 'practical mod_perl-chapter 10:improving performance with shared memory and proper forking', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Page 349 Thursday November 18 2004 12 40 PM CHAPTER 10 Improving Performance with Shared Memory and Proper Forking In this chapter we will talk about two issues that play an important role in optimizing server performance sharing memory and forking. Firstly mod_perl Apache processes can become quite large and it is therefore very important to make sure that the memory used by the Apache processes is shared between them as much as possible. Secondly if you need the Apache processes to fork new processes it is important to perform the fork calls in the proper way. Sharing Memory The sharing of memory is a very important factor. If your OS supports it and most sane systems do a lot of memory can be saved by sharing it between child processes. This is possible only when code is preloaded at server startup. However during a child process s life its memory pages tend to become unshared. Here is why. There is no way to make Perl allocate memory so that dynamic variables land on different memory pages from constants or the rest of your code which is really just data to the Perl interpreter so the copy-on-write effect explained in a moment will hit almost at random. If many modules are preloaded you can trade off the memory that stays shared against the time for an occasional fork of a new Apache child by tuning the MaxRequestsPerChild Apache directive. Each time a child reaches this upper limit and dies it will release its unshared pages. The new child will have to be forked but it will share its fresh pages until it writes on them when some variable gets modified . The ideal is a point where processes usually restart before too much memory becomes unshared. You should take some measurements to see if it makes a real difference and to find the range of reasonable values. If you have success with this tuning bear in mind that the value of MaxRequestsPerChild will probably be specific to your situation and may change with changing circumstances. 349 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
98    102    2    17-05-2024
109    308    1    17-05-2024
Đã 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.