Tsab ntawv teev npe
Rau cov neeg ua lag luam online , siv WordPress los tsim cov vev xaib , ua lag luam e-lag luam , thiab txhawb cov khoom lag luam online tuaj yeem txhim kho qhov ceev ntawm lub vev xaib thiab, qee qhov, txhim kho kev ua tau zoo SEO.
Tom qab txhim kho lub tshuab Linux xws li VestaCP control panel , koj tuaj yeem xaiv qee qhov caching extensions los txhim kho PHP ceev.

Feem ntau pom yog cov cache extensions:
Qhov txawv ntawm lawv yog dab tsi?Lub luag haujlwm yog dab tsi?Peb yuav tsum xaiv li cas?
Chen Weiliang yuav muab cov lus teb hauv tsab xov xwm no.
XNUMX. Alternative PHP Cache (APC cache)

Lwm hom PHP Cache (APC Cache) yog qhov qhib qhov chaw caching rau PHP, siv los cache Opcode (khoom siv) PHP intermediate code.
Lub cache ntawm APC tau muab faib ua 2 ntu:
- system cache
- Cov neeg siv cov ntaub ntawv cache
Lub kaw lus cache yog siv tau:
- Qhov no txhais tau hais tias APC caches qhov muab tso ua ke tshwm sim ntawm lub hauv paus code ntawm PHP cov ntaub ntawv thiab ces invokes lub sij hawm dua.
- Yog tias nws tsis tau tas sijhawm, khiav nws nrog lub cached code.
- Lub neej ntawd cache yog 3600 (ib teev).
Tab sis qhov no tseem nkim sijhawm ntau CPU.
Yog li ntawd, koj tuaj yeem teeb tsa lub kaw lus cache kom tsis txhob tag sijhawm hauv php.ini cov ntaub ntawv, thiab teeb tsa lub kaw lus cache kom tsis tas sijhawm (apc.ttl=0).
Txawm li cas los xij, ua qhov no yuav tsum rov pib lub web server (piv txwv li, apache) tom qab hloov PHP code.
Tam sim no, APC kev ntsuas kev ua tau zoo feem ntau yog hais txog cache ntawm txheej txheej no;
Qhov tseeb, Alternative PHP Cache (APC Cache) kuj tseem tuaj yeem suav tias yog ib qho hauv nco cache txuas ntxiv,
Nws yog ib tug database cache extension.
XNUMX. eAccelerator
eAccelerator yog qhov pub dawb thiab qhib qhov PHP accelerator.
- Optimization thiab dynamic cov ntsiab lus caching, uas tuaj yeem txhim kho kev ua haujlwm caching ntawm PHP scripts.
- Yog li, PHP tsab ntawv tuaj yeem khaws cia rau hauv lub xeev muab tso ua ke kom txo tau cov peev txheej siv ntawm lub server.
- Nws kuj tseem optimizes scripts los txhim kho kev ua tau zoo, nce qhov ua tau zoo ntawm PHP code los ntawm 1-10 zaug.
- eAccelerator tsis txhawb PHP5.5 lossis tom qab.
Raws li cov ntawv nyeem qhia: eAccelerator yog ib qho kev txuas ntxiv accelerator hauv PHP.
XNUMX. XCache
XCache yog qhov qhib qhov chaw opcode tsis/optimizer uas txhim kho PHP kev ua tau zoo ntawm lub server.
- Koj tuaj yeem zam rov qab cov txheej txheem muab tso ua ke los ntawm caching cov ntaub ntawv PHP uas tau muab tso ua ke hauv kev nco
- Thiab koj tuaj yeem siv qhov tsis ncaj qha los sau cov lej txhawm rau txhim kho qhov nrawm.
- Nws feem ntau tuaj yeem nce nplooj ntawv tsim cov nqi los ntawm ib qho ntawm 2 txog 5 thiab txo cov neeg rau zaub mov load.
Qhov tseeb, XCache yog PHP accelerator extension.
Plaub, memcached
Memcached yog qhov ua tau zoo tshaj plaws faib khoom nco caching system:
- Siv nyob rau hauv dynamic web daim ntaub ntawv los txo database load.
- Nws txo cov naj npawb ntawm cov ntaub ntawv nyeem los ntawm caching cov ntaub ntawv thiab cov khoom hauv lub cim xeeb, yog li muab qhov ceev ntawm cov vev xaib uas muaj zog, cov ntaub ntawv-tsav.
Nws tuaj yeem nkag siab los ntawm cov ntawv nyeem: nco cache nthuav dav, siv ntau dua rau pawg servers, feem ntau yog siv rau kev faib cache.
Memcached yog suav tias yog database cache extension.
XNUMX. Redis
Redis yog cov ntaub ntawv muaj txiaj ntsig zoo tshaj plaws.

- Qhov tshwm sim ntawm redis tau zoo heev rau qhov tsis muaj keyalue cia xws li memcached.
- Qee zaum, nws tuaj yeem ntxiv cov ntaub ntawv sib raug zoo.
- Feem ntau, Redis feem ntau piv rau memcached.
Ntau tus neeg xav tias Redis tuaj yeem hloov pauv tag nrho memcached, vim Redis muaj ntau hom ntaub ntawv thiab kev ua haujlwm tsis nyob hauv memcached:
- Redis muaj memcached tab sis tsis;
- Memcached thiab redis muaj ob qho tib si.
Raws li kuv paub, Sina's Weibo thiab lwm yam khoom siv peripheral cia siab rau Redis, uas tuaj yeem pom muaj zog.
Qhov txawv ntawm PHP cache thiab database cache extension
1) PHP cache extension:
- eAccelerator, XCache yog PHP cache extensions.
2) Database cache extension:
- Redis, memcached, APC cache yog database cache extensions.
(Feem ntau ob tus neeg tsuas yog yuav tsum tau nruab ib qho ntawm lawv, tsis txhob khav theeb)
Tom qab qee qhov kev sim, nws tau pom tias Cache cov ntaub ntawv cache tau dhau ntawm qhov chaw pib, thiab APC kev ua tau zoo tsis zoo li mcached cache.
Yog li ntawd, thaum xaiv ib tug cache extension, ib co neeg yuav xaiv ib tug ua ke ntawm xcache + memcached, los yog ib tug ua ke ntawm xcache + redis.
Yog tias qhov yuam kev tshwm sim thaum txhim kho ntau lub cache extensions tib lub sijhawm, nws raug pom zoo kom nruab ib lub cache txuas ntxiv thiab tshem tawm lwm tus.
PHP Accelerator Comparison Summary
- Los ntawm kev sim, eAccelerator yog qhov zoo tshaj plaws ntawm kev thov lub sijhawm thiab kev siv nco, tab sis eAccelerator tsis txhawb PHP 5.5 lossis tom qab.
- Los ntawm kev sim, qhov ceev nrog lub accelerator yog 3 zaug sai dua li tsis muaj lub accelerator.
Cov saum toj no piav qhia txog cov haujlwm thiab qhov sib txawv ntawm APC, eAccelerator, XCache, memcached, thiab Redis .
Vam tias, tsab xov xwm "Qhov sib txawv ntawm APC, eAccelerator, XCache, memcached, thiab Redis" uas tau muab qhia rau ntawm Chen Weiliang lub blog ( https://www.chenweiliang.com/ ) yuav pab tau koj.
Xav qhia qhov txuas ntawm tsab xov xwm no: https://www.chenweiliang.com/cwl-940.html
