المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : الفرق بين mpm worker vs prefork ومن الافضل فى الأداء والاستخدام ؟



Rise Company
14-01-2020, 00:34
أفضل إعدادات لخادم الويب أباتشي و الفرق بين mpm worker vs prefork
event MPM vs worker MPM vs prefork MPM
Apache MPMs – Prefork vs Worker vs Event
Apache performance tip – switch to MPM Event!

https://www.rise.company/forum/images/imported/2020/01/61.png

وحدات المعالجة المتعددة MPM

عليك اختيار أحد الوحدات الثلاثة الخاصة بالمعالجة المتعددة MPM

prefork - الأكثر استقرارا أو لأغراض التوافقية
worker - أعلى أداء من الذي قبله للمواقع التي تحتاج موازاة أكثر
event - تطوير تجريبي من الذي قبله لمزيد من الأداء

----------------------------------------------------------------------

Prefork



Implements a non-threaded, pre-forking web server.
The default one, most stable and also compatible with older software. Unfortunately, also the slowest.
I’m guessing it’s called that because it’s the original version before they forked off into the other versions.
You will almost always find this one installed by default as many companies are too lazy to reconfigure hundreds of their servers. There’s also a shady skepticism that they don’t want your server to perform that well since they want to upsell you to a bigger server sooner.

Worker



Multi-Processing Module implementing a hybrid multi-threaded multi-process web server.
Faster than prefork and can handle more visitors.

Event



A variant of the worker MPM with the goal of consuming threads only for connections with active processing.
The fastest MPM and considered least stable…although fine for most people in real-world practices.
Uses the least resources and can handle the most visits.


What’s the verdict?

Go with MPM Event first. You can switch over to it easy. A few command line entries or also a simple switch in EasyApache if you have WHM/cPanel (show in the image above).
If you have problems, then try Worker and that last is Prefork. Some people noticed faster performance with Prefork or Worker. It can depend on the type of website you have, CPU, ram use, etc. But generally with a high performance server looking to serve many visitors fast, I always recommend MPM Event.


----------------------------------------------------------------------

If your system requires threads and allows for safe thread-polling, use the event MPM.
If your system requires threads, but does not allow for safe thread-polling, use the worker MPM.
If your system does not require threads and does not allow for safe thread-polling, use the prefork MPM



Remember:
If you do not select an MPM option, EasyApache installs the prefork MPM by default.
EasyApache 4 only builds one MPM into your Apache configuration.
The MPM ITK module is not an MPM. You must use the prefork MPM in order to use the MPM ITK Apache module. For more information, read the The MPM ITK module (https://documentation.cpanel.net/display/EA4/Multi-Processing+Modules+-+MPMs#Multi-ProcessingModules-MPMs-MPMITK) section.
cPanel & WHM only supports systems that offer threads and safe-thread polling.


المرجع:
https://documentation.cpanel.net/display/EA4/Multi-Processing+Modules+-+MPMs
https://wpjohnny.com/apache-performance-tip-switch-to-mpm-event/

Rise Company
14-01-2020, 00:50
I think the performance highly depends on your requirements and resource availability. Prefork is an excellent option if you have better RAM. But when it comes to servers with relatively lower RAM, Worker and event appear to out perform prefork.

---------------------------------------------------------------------------

For your information, my issue with MPM prefork was related to wordpress. For some reasons, the Mariadb transactions are slower using Prefork rather than worker with Wordpress. I used other CMS or coded myself PHP to mariadb and saw that prefork was great. .

---------------------------------------------------------------------------

Prefork is a more stable mpm. But both memory and CPU have their disadvantages. Not efficient in process management. Separate processing for each request is causing high resource consumption.

Mpm event is more efficient in resource usage. But in some cases it is not as stable as prefork.

I'm testing mpm event + php-fpm. I did not have a big problem, everything is fine.