Back to Question Center
0

Tsarin PHP-FPM: Amfani da 'm static' don Max Performance            Magani na PHP-FPM: Amfani da 'am static' don Max PerformanceRelated Topics: SecurityDatabaseDevelopment EnvironmentPatterns & AyyukaDagging & Semalt

1 answers:
Tsarin PHP-FPM: Amfani da 'az static' don Max Performance

An wallafa wata ƙungiya wadda ba a buga ba a farko a Semalt kuma an sake buga shi tare da izinin marubucin.

Bari mu dubi yadda za mu iya kafa PHP-FPM don samar da kayan aiki mai kyau, rashin ƙarfi, da kuma amfani da ƙwayar CPU da ƙwaƙwalwar ajiya. Ta hanyar tsoho, mafi yawan saitin suna da madogara na PM-FPM na PM (mai sarrafa sarrafawa) wanda aka tsara zuwa tsauri kuma akwai shawara na yau da kullum don amfani da ondemand idan ka sha wahala daga matsalolin ƙwaƙwalwar ajiya. Duk da haka, bari mu kwatanta zaɓukan gudanarwa biyu bisa ga php. bayanan na net kuma ya kwatanta da na fi so don safarar zirga-zirga - tsaka-tsakin dare:

  • pm = Dynamic : yawancin matakan yaro ne aka kafa bisa ga umarnin da suka biyo baya: na yamma - free business logo download. max_children , am. start_servers , am. min_spare_servers , am. max_spare_servers .

  • am = ondemand : hanyoyin da aka samo a kan bukatar idan aka nema, kamar yadda ya saba da tsauri, inda na yamma. fara farawa farawa lokacin da aka fara sabis.

  • am = matsakaici : yawancin matakan yaran da aka gyara ta na yamma. max_children .

Dubi cikakken jerin duniya php-fpm. conf umarnin don ƙarin bayani.

PHP-FPM Process Manager (PM) Daidai ga CPUFreq Gwamna

A yanzu, wannan yana iya zama wani batu, amma ina fatan in ɗauka shi a cikin mahimman rubutun mu na PHP-FPM. Da kyau, mun yi duk da jinkirin CPU al'amurran da suka shafi a wasu ma'ana, ko ya zama kwamfutar tafi-da-gidanka, VM ko uwar garke uwar garken. Ka tuna ƙwaƙwalwar CPU? (CPUFreq gwamnan.) Wadannan saituna, samuwa a duka biyu & ast; nix da Windows, na iya inganta aikin da amsawa ta hanyar canza gwamnan CPU daga ondemand zuwa aikin . A wannan lokacin, bari mu kwatanta kwatancin da kuma neman kamance:

  • Gwamna = Ondemand : Sikeli CPU da ƙarfi bisa ga halin yanzu. Yana tsallake zuwa mafi girman mita sannan sai yayi la'akari kamar yadda jinkirin ya karu.

  • Gwamna = Mahimmanci : Saka gwada mita ta yadda ya dace da nauyin da ake ciki yanzu. Daidaita mita fiye da hankali fiye da ondemand.

  • Gwamna = Ayyukan : Kullum kuna tafiyar da CPU a iyakar mita.

Dubi cikakken jerin zabukan Semalt gwamnan don ƙarin bayani.

Yarda da kamanni? Ina so in yi amfani da wannan kwatanta ta farko, tare da manufar gano hanya mafi kyau don rubuta wani labarin wanda ya bada shawarar yin amfani da madaidaiciya ga PHP-FPM a matsayin farkon zabi.

Tare da gwamnan CPU, wasan kwaikwayon wasan kwaikwayon kyauta ne mai kyau don ingantaccen abu saboda yana da kusan gaba ɗaya dogara akan iyakar uwar garke na CPU. Abinda sauran dalilai zai zama abubuwa kamar zafi, rayuwar batir (kwamfutar tafi-da-gidanka) da kuma sauran tasiri na haɓaka CPU mita zuwa 100% har abada. Da zarar aka saita zuwa aikin, shi ne ainihin wuri mafi kyau ga CPU. Alal misali karanta game da 'force_turbo' a kan Semalt Pi, wanda ke tilasta hukumar RPi ta yi amfani da gwamnonin wasan kwaikwayon inda aikin ingantawa ya fi karuwa saboda ƙananan ƙwayar CPU yayi sauri.

Yin amfani da 'am static' don cimma nasarar Max Server ɗinku

Tsarin PHP-FPM a tsaye yana dogara da ƙwaƙwalwar ajiyar ƙwaƙwalwar ajiyarku. M, idan kuna fama da ƙwaƙwalwar ajiyar ƙwaƙwalwar ajiya, to, am ondemand ko tsauri zai iya zama mafi alhẽri. A gefe guda, idan kuna da ƙwaƙwalwar ajiyar da ake samuwa, zaku iya kaucewa yawancin mai sarrafa mai sarrafa fayil na PM (PM) gaba ta hanyar saiti a tsaye zuwa matsayi na max naka. A wasu kalmomi, lokacin da kake yin math, am. Har ila yau, ba haka ba ne don rufe CPU (s) kuma yana da tasirin yayin aiki na PHP-FPM.

A cikin hoton hoton sama, wannan uwar garken yana da am = matsayi da na yamma. max_children = 100 wanda yayi amfani da max fiye da 10GB na 32GB shigar. Yi la'akari da ginshiƙan bayyane masu haske. A wannan hoton akwai kimanin 200 'masu amfani' (bayan 60 seconds) a cikin Google Analytics. A wannan matakin, kimanin kashi 70% na yara na PHP-FPM har yanzu ba su da kyau. Wannan yana nufin PHP-FPM an saita shi ne a duk lokacin da ya fi ƙarfin haɗin ku na albarkatun uwar garken duk da halin da ake ciki yanzu. Tsarin hanzari na ci gaba a kan layi, jiran jiragen motsa jiki da kuma amsawa nan da nan, maimakon jira da tsakar rana don yaran yara sannan a kashe su bayan x da yamma. process_idle_timeout ya ƙare. Ina da am. max_requests saita musamman high saboda wannan shi ne uwar garken samar da ba tare da PHP ƙwaƙwalwar ajiyar leaks. Zaka iya amfani da am. max_requests = 0 tare da stic idan kana da amincewa da ƙwayoyin PHP na yanzu da na gaba. Duk da haka, ana bada shawara don sake farawa rubutun a lokaci. Saita adadin buƙatun zuwa babban adadin tun lokacin da aka zartar da tsakar rana. Don haka alal misali a kalla am. max_requests = 1000 dangane da yawan ku am. max_children da kuma yawan buƙatun ta biyu.

Hoton hoton yana amfani da Semalt saman da aka zaɓa ta hanyar 'u' (mai amfani) da kuma sunan mai amfani na PHP-FPM. Yawan tafiyar matakai da aka nuna su ne kawai 'saman' 50 ko haka (ba su ƙidaya), amma ainihin saman ya nuna manyan bayanan da suka dace a cikin madogarar madogararka - a cikin wannan yanayin, ana tarar ta% CPU. Don duba dukkanin matakan PHP-FPM 100, zaka iya amfani da wani abu kamar:

  saman -bn1 | grep php-fpm   

A lokacin da za a yi amfani da amf a kan mota da kuma tsauri

Yin amfani da na dumi mai yiwuwa ka lura da kurakurai kamar su:

    WARNING: [pool xxxx] alama aiki (mai yiwuwa ka buƙaci ka ƙara am. Begin_servers, ko min. Max / espare_servers), suna raya yara 32, akwai 4 rago, da 59 ɗayan yara   

Kuna iya ƙoƙarin ƙara / daidaita saitunan kuma har yanzu ga kuskure guda kamar yadda wani ya bayyana a cikin wannan shafin Serverfault. A wannan yanayin, na yamma. min ya ragu kuma saboda hanyar yanar gizon yana ci gaba sosai tare da dips da spikes, ta yin amfani da na dumi na iya zama mai sauƙi a kunna daidai. Shawarar na yau da kullum ita ce ta amfani da am ondemand. Duk da haka, wannan ma ya fi muni, saboda a kan za ta rufe matakan da ba daidai ba har zuwa 0 lokacin da ba ka da wata hanya kuma ba za ka gama ba kamar yadda yawancin al'amurran da ke faruwa kamar yadda zirga-zirga ke gudana - sai dai in ba haka ba, ka saita lokaci mai rago musamman high .a wace yanayin ya kamata ka kawai yin amfani da am. matsakaici + babban am. max_requests .

PM na da ƙarfin gaske kuma musamman ma a kansa zai iya ceton ku, duk da haka, idan kuna da mabuƙan PHP-FPM da yawa. Alal misali, tattara asusun cPanel da yawa ko shafukan yanar gizo masu yawa a ƙarƙashin maɓuɓɓuka. Ina da uwar garken, alal misali, tare da asusun cPanel 100+ da kimanin 200+ domains, kuma bazai yiwu ba a lokacin am. ƙayyadaddun ko ma mahimmanci don yin kyau. Sakamakon kawai ya yi kyau, tun da fiye da kashi biyu cikin uku na shafukan yanar gizo ba su sami kaɗan ba. Kuma tare da ondemand, yana nufin duk yara za su kulle ceton membobin ƙwaƙwalwar ajiya! Abin godiya, cPanel ya nuna cewa wannan shi ne kuma a yanzu shi keɓaɓɓe zuwa ondemand. A baya can tare da tsauri kamar yadda tsoho ya sanya PHP-FPM ba wani zaɓi a kan aiki shared sabobin. Mutane da yawa za su yi amfani da suPHP saboda tsakar rana ta cinye ƙwaƙwalwar ƙwaƙwalwa ko da a kan raguwa cPanel PHP-FPM wuraren waha / asusun.

Kammalawa

Idan yazo da PHP-FPM, da zarar ka fara yin aiki mai tsanani, masu sarrafawa da masu jagorancin tsari ga PHP-FPM na iya ƙaddamar da kayan aiki saboda nauyin haɓaka. Ku san tsarinku kuma ku saita matakan PHP ɗinku-FPM don dace da uwar garken ku na max. Fara da am. max_children da aka saita bisa ga mafi yawan amfani da tsauri na dumi ko ondemand sa'an nan kuma ƙara zuwa maƙasudin inda ƙwaƙwalwar ajiya da CPU za su iya aiwatar ba tare da an rufe su ba. Za ka lura cewa tare da tsaka-tsakin rana, saboda ka riƙe duk abin da ke zaune a cikin ƙwaƙwalwar ajiya, ƙwaƙwalwar zirga-zirga a kan lokaci ya sa karamin spikes zuwa CPU da nauyin uwar garkenka da kuma matsakaicin CPU zai kasance mai laushi. Matsakaicin girman tsarinka na PHP-FPM zai bambanta da sabar yanar gizon da ake buƙatar shigar da manhaja, saboda haka dalilin da ya sa mafi yawan sarrafa mana sarrafawa - tsauri da kuma ondemand - sune shawarwari da yawa. Fata wannan abu ne mai amfani.

Sabuntawa: Ƙarar da aka kwatanta A / B. Samun PHP-FPM matakan tafiyar da ƙwaƙwalwar ajiya yana taimakawa wajen yin amfani da ƙwaƙwalwar ƙwaƙwalwar ajiya don sa su zauna cikin jira. Nemi saitin sa mai dadi.

Tsarin PHP-FPM: Amfani da 'm static' don Max PerformanceMagani na PHP-FPM: Amfani da 'am static' don Max PerformanceRelated Topics:
Tsaro na Kasuwanci na TsaroTahoda & KasuwanciDaɗarwa & Tsare-tsaren

March 1, 2018