Tuhinga Tuhinga
Tauhokohoko Ipurangiwhakamahi tangatapaetukutuku WordPress, MahiE-tauhokohokoAWhakatairanga Tukutuku, ki te whakapai ake i te tere o te paetukutuku, ka taea te whakapai ake ki tetahi waahangaSEOpaanga
tāutaVestaCPpaewhiri mana etc.LinuxWhai muri i te punaha, ka taea te kowhiri i etahi toronga keteroki hei whakanui ake i te tere o te PHP.

I te nuinga o te wa ka kitea enei toronga keteroki:
- APC
- eWhakatere
- XCache
- memcached
- Redis
He aha te rereketanga i waenga i a raatau?He aha te mahi?Me pehea tatou e whiriwhiri ai?
Ko Chen WeiliangKa hoatu e ahau te whakautu ki a koe i roto i tenei tuhinga.
XNUMX. Keteroki PHP rereke (Keteroki APC)

Ko te Keteroki PHP rereke (APC Cache) he taputapu keteroki puna tuwhera mo te PHP, whakamahia ki te keteroki Opcode (kōnae ahanoa) PHP waehere takawaenga.
Kua wehea te keteroki o te APC kia 2 nga wahanga:
- keteroki pūnaha
- Keteroki raraunga kaiwhakamahi
Ka whakamahia aunoatia te keteroki pūnaha:
- Ko te tikanga ka keteroki a APC i te hua whakahiato o te waehere puna o te konae PHP, ka tono ano i te tohu wa.
- Mena kaore ano kia pau, whakahaere me te waehere keteroki.
- Ko te keteroki taunoa he 3600 (kotahi haora).
Engari ka pau tonu tenei i te wa PTM.
Na reira, ka taea e koe te tautuhi i te keteroki punaha kia kaua e pau i roto i te konae php.ini, me te tautuhi i te keteroki punaha kia kaua e pau (apc.ttl=0).
Heoi, ki te mahi i tenei me whakaara ano te tūmau tukutuku (hei tauira, apache) i muri i te huri i te waehere PHP.
I tenei wa, ko te whakamatautau mahi APC e pa ana ki te keteroki o tenei paparanga;
Ko te tikanga, ka taea hoki te whakaaro keteroki PHP Keteroki (APC Cache) hei toronga keteroki mahara-roto,
He toronga keteroki pātengi raraunga.
XNUMX. Whakatere
Ko te eAccelerator he kaiwhakatere PHP koreutu me te tuwhera.
- Te arotautanga me te keteroki ihirangi hihiri, ka pai ake te mahi keteroki o nga tuhinga PHP.
- Na reira, ka taea te tuhi PHP i roto i te ahua whakahiato hei whakaiti i te kai rauemi o te tūmau.
- Ka arotau ano hoki i nga tuhinga, te whakapai ake i te pai o te mahi, me te whakanui ake i te kaha o te waehere PHP ma te 1-10 nga wa.
- Karekau a eAccelerator e tautoko i te PHP5.5 i muri mai ranei.
Ka rite ki te maarama mai i te tuhinga:Ko te eAccelerator he toronga whakatere i roto i te PHP.
XNUMX. XCache
Ko te XCache he puna tuwhera opcode buffer/optimizer e pai ake ana te mahi PHP i runga i te tūmau.
- Ka taea e koe te karo i te tukurua i te tukanga whakahiato ma te keteroki i nga raraunga PHP kua whakahiato i roto i te mahara tiritahi
- A ka taea e koe te whakamahi tika i te kaitarai ki te whakahiato i te waehere hei whakapai ake i te tere.
- Ka taea e ia te whakanui ake i nga reiti whakangao wharangi ma te 2 ki te 5 me te whakaiti i te kawenga o te tūmau.
Parau mauKo te XCache he toronga whakatere PHP.
Tuawha, memcached
Ko te Memcached he punaha keteroki ahanoa mahara kua tohatoha mahi nui:
- Ka whakamahia i roto i nga tono tukutuku hihiri hei whakaiti i te utaina o te papaarangi.
- Ka whakaitihia te maha o nga paanui paanui ma te keteroki raraunga me nga taonga kei roto i te mahara, na reira ka tere te tere o nga paetukutuku hihiri, e peia ana e te papaarangi.
Ka taea te mohio mai i te tuhinga: te roha keteroki mahara, ka nui ake te whakamahi mo nga tuunga tautau, te nuinga ka whakamahia mo te keteroki tohatoha.
Ko te Memcached e kiia ana he toronga keteroki pātengi raraunga.
XNUMX. Redis
Ko Redis he putunga uara matua mahi nui.

- Ko te putanga mai o te redis kua nui te utu mo te kore o te rokiroki keyalue penei i te memcached.
- I etahi wa, ka taea e ia te whakakii i nga paaunga hononga.
- I te nuinga o nga wa, ka whakatauritea a Redis ki te memcached.
He maha nga tangata e whakaaro ana ka taea e Redis te whakakapi katoa i te memcached, na te mea he pai ake nga momo raraunga Redis a kaore nga mahi i raro i te memcached:
- Redis kua memcached engari kahore;
- Kei a Memcached me te redis nga mea e rua.
Ki taku mohio, ko te Weibo a Sina me etahi atu hua taapiri e whakawhirinaki ana ki a Redis, ka kitea he kaha.
Te rereketanga i waenga i te keteroki PHP me te toronga keteroki putunga raraunga
1) toronga keteroki PHP:
- eAccelerator, XCache he taapiri keteroki PHP.
2) toronga keteroki pātengi raraunga:
- Redis, memcached, APC keteroki he toronga keteroki pātengi raraunga.
(I te nuinga o nga wa e rua nga tangata me whakauru i tetahi o ratou, kaua e apo)
I muri i etahi whakamatautau, i kitea kua nui ake te keteroki raraunga Cache i tetahi paepae, a, kaore i pai te mahi a te APC ki te keteroki mcached.
Na reira, i te wa e whiriwhiri ana i te toronga keteroki, ka kowhiria e etahi tangata he huinga xcache + memcached, he huinga xcache + redis ranei.
Mena ka puta he hapa i te wa e whakauru ana i nga toronga keteroki maha i te wa kotahi, ka tūtohu kia whakauruhia kia kotahi anake te toronga keteroki me te tango i etahi atu.
PHP Accelerator Whakataurite Whakarāpopototanga
- Na roto i te whakamatautau, ko te eAccelerator te huinga pai o te wa tono me te whakamahinga mahara, engari kaore e tautokohia e eAccelerator PHP5.5 i muri mai ranei.
- Na roto i te whakamatautau, ko te tere me te whakatere he 3 nga wa tere atu i te kore o te whakatere.
Ko te runga ake koAPC, eAccelerator, XCache, memcached, Redistūranga me ngā rerekētanga i waenganui i a rātou.
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) Ko te rereketanga i waenga i te APC, eAccelerator, XCache, memcached, Redis tiri, awhina ki a koe.
Nau mai ki te tohatoha i te hono o tenei tuhinga:https://www.chenweiliang.com/cwl-940.html
Hei whakatuwhera i etahi atu tinihanga huna🔑, nau mai ki te uru mai ki ta maatau hongere Telegram!
Tohaina me te pai ki te pai koe! Ko o tohatoha me o hiahia ko to matou hihiri tonu!