Using PHP-MySQL Persistent Connections to Run WordPress Blog Naudojant PHP-MySQL patvariųjų Jungtys Vykdyti WordPress blog
When connecting to MySQL database, WordPress weblog based on PHP scripting will use non-persistent connection by default. Jei prisijungti prie MySQL duomenų bazė, WordPress weblog remiantis PHP skriptų naudoja ne nuolatinis ryšys pagal nutylėjimą. That is, WordPress will trigger PHP to generate a new connection to MySQL server for each dynamic page request, and subsequently close the database connection once the web page building is completed. Tai reiškia, kad WordPress bus sukelti PHP sukurti naują ryšį su MySQL serverio kiekvienam dinaminio puslapio prašymą ir vėliau uždaryti duomenų bazę, kai tinklalapio kūrimo yra baigta. Repetitive opening and closing of MySQL connections causes overheads and uses up precious CPU, memory and system resources on the web host. Pasikartojančios atidarymo ir uždarymo MySQL jungčių sukelia viršutinės ir naudoja ne tauriųjų procesoriaus, atminties ir išteklių sistemos į žiniatinklio prieglobos.
Using persistent connection to connect to MySQL database server is not always a good option. Naudodamiesi nuolatinių ryšio prisijungti prie MySQL duomenų bazių serveris, ne visada yra geras pasirinkimas. Each connections takes up resources, including memory, buffers, table or thread caches internally in MySQL and sockets, open files or IO activity at OS level. Kiekviena jungtis užima išteklių, įskaitant atminties buferio, stalo arba temoje talpyklos viduje MySQL ir kištukiniai lizdai, atidaryti failus, arba IO veiklos OS lygiu. Thus when a lot of persistent connections are opened but not closed after transactions are completed, the resources on system may drain up and degrade performance of web server, or in worst case, cause HTTP failure. Taigi, kai daug patvarios jungtys yra atidarytas, bet ne uždaryti po sandoriai baigti, išteklių sistema gali nusausinti ir degraduoja atlikti žiniatinklio serveryje, arba blogiausiu atveju, sukelti HTTP nepakankamumas. Furthermore, if a persistent connection is stalled, inactive or became defunct or no longer in used, it is not terminated, and MySQL server will only close it to release the resource occupied by the connection after about 28800 seconds (8 hours) by default unless changed the timeout parameters in my.cnf configuration files. Be to, jei nuolatinis ryšys užstrigo, neaktyvūs arba tapo pasenusios arba nebeatitinka, jis nėra nutrauktas, ir MySQL serverio bus tik uždaryti išleisti išteklių okupuotų ryšį po maždaug 28800 sekundžių (8 valandas), nebent pakeitė laiko parametrus my.cnf konfigūracijos failus. This few factors may bring troubles such as MySQL refusing new DB connections or slow server if the applications do not properly handle persistent connections. Šis keli veiksniai gali sukelti problemų, tokiomis kaip MySQL atsisakyti naujų BP jungčių arba lėtai serverio, jei paraiškos nėra tinkamai valdyti patvarūs ryšiai. Thus if you're not experience webmasters, please do not attempt to change Wordpress to use persistent connections. Taigi, jei nesate patirtį webmasters, prašome ne bandyti pakeisti WordPress naudotis nuolatiniai ryšiai.
However, for bloggers who have busy and large blog, and facing constraints in upgrading web host system specifications, and do not want to use static page caching plugin such as WP-Cache, persistent connection is a available option to tune and optimize the web server to see if the webpage serving can be faster. Tačiau, Bloggers, kurie yra užimtas ir didelis dienoraštį, ir susiduria su apribojimais pagerinti žiniatinklio prieglobos sistemos specifikacijas ir nenorite naudoti statinį puslapį buforowanie įjungti pvz WP-niais, patvarūs ryšiu yra prieinama galimybė suderinti ir optimizuoti interneto serverio norėdami pamatyti, jei tinklalapio įteikimą galima greičiau. Persistent connection allows connection to be open once and will not be closed when the execution of the script ends. Patvarūs ryšys leidžia ryšį būtų galima atidaryti vieną kartą ir bus uždaryta, kai vykdant scenarijų baigiasi. Instead, the link is kept in pool and will remain open for future use. Vietoj to, nuoroda yra saugoma baseinas ir išliks atvira ateityje. Thus, using persistent connections will eliminate the process of opening and closing the connection. Taigi, naudojant patvarūs ryšiai bus pašalinti procesas atidaryti ir uždaryti ys. This will indirectly reduce MySQL connection related server overheads such as authentication to establish connection where only once is needed, saving extra network traffic, and resources used to handle extra connection. Tai netiesiogiai sumažinti MySQL ryšio susiję serverio pridėtinių išlaidų, tokių kaip autentiškumo nustatyti ryšį, kai tik reikia, sutaupant papildomą srautą, ir ištekliai, naudojami dirbti su papildomų ryšį. Beside, there could be some connection level caches, which need to be filled up for proper performance, and potentially reduce the number of connections to the database. Šalia, gali būti kai kurių ryšys lygio talpyklos, kurias reikia užpildyti ir tinkamai atlikti, ir potencialiai sumažinti skambučių į duomenų bazę.
By default, WordPress is using mysql_connect() function that establishes a new database connection on every page. Pagal nutylėjimą, WordPress naudoja mysql_connect () funkciją, kuri sukuria naują duomenų bazę apie kiekvieną puslapį. The persistent connection feature will require mysql_pconnect() function which uses the exact same API, but has built-in connection pooling to keep connections alive between requests. Nuolatinis ryšio funkcija reikalauja mysql_pconnect () funkciją, kurie naudoja tą patį API, tačiau turi įmontuotą ryšio kaupti išlaikyti ryšius gyvas tarp prašymus. So to switch to use persistent connection to run WordPress, the mysql_connect() function has to be replaced with mysql_pconnect(). Taigi pereiti naudotis nuolatinių ryšio paleisti WordPress, kad mysql_connect () funkciją, turi būti pakeistos mysql_pconnect ().
To enable and use persistent connections with WordPress, simply login to your web host with SSH (or insecure Telnet), and change to the webroot home directory where WordPress blog is installed. Norìdami çjungti ir naudoti nuolatinių ryšių su WordPress, tiesiog prisijungti prie savo žiniatinklio prieglobos su SSH (ar nesaugių TELNET), ir pakeisti į webroot namų katalogą, kur WordPress dienoraštis įdiegta. Then change directory into wp-includes directory. Tada pakeisti katalogo į wp-includes kataloge. Inside the wp-includes directory, there is wp-db.php file. Viduje wp-includes kataloge yra wp-db.php failą. Use any text editor such as vi to edit wp-db.php. Naudoti bet tekstų redaktorių, tokį kaip vi redaguoti wp-db.php. Search or locate the function of mysql_connect (or @mysql_connect ). Ieškoti arba suraskite funkcija mysql_connect (arba @ mysql_connect). There is only one instance of mysql_connect. Yra tik vienas egzempliorius mysql_connect. Just change the mysql_connect to mysql_pconnect , then save and exit the wp-db.php. Tiesiog pakeisti mysql_connect į mysql_pconnect, tada išsaugokite ir išeikite iš wp-db.php. WordPress and PHP (as long as you don't turn off the mysql.allow_persistent in PHP.INI) will immediately use persistent connections to connect to MySQL database. Wordpress ir PHP (kol nereikia išjungti mysql.allow_persistent į php.ini) bus iš karto naudoti patvarios jungtys, norint prisijungti prie MySQL duomenų bazė. It's worth to try out which setting is best for your environment. Tai verta pabandyti, kuris parametras yra geriausias jūsų aplinką.
IMPORTANT : The page is machine translated and provided "as is" without warranty. DĖMESIO: Šis puslapis yra mašina išvertė ir pateikiama "kaip yra" be garantijų. Machine translation may be difficult to understand. Mašininio vertimo, gali būti sunku suprasti. Please refer to Remkitės original English article originalas anglų straipsnis whenever possible. jei įmanoma.
Related Articles Susiję straipsniai
- How to Move WordPress Blog to New Domain or Location Kaip perkelti WordPress Blog į naują domeną arba Vietovė
- WordPress MySQL SQL Query Error in WPDB Class WordPress MySQL, SQL Query Klaida WPDB klasė
- Moderate WordPress Blog Comments Via Moderator with Desktop Client Vidutinis WordPress blog Komentarai Via Moderatorius su darbalaukio kliento
- How to Customize, Modify or Change WordPress Database Connection Error Page Kaip pritaikyti, Keisti arba Keisti WordPress prisijungti prie duomenų bazės klaida Puslapis
- Replace Google Blog Search with Technorati for Incoming Links in Dashboard of WordPress Pakeisti "Google Blog Search Technorati su už gaunamus Nuorodos į Dashboard į WordPress
- WLWManifest Disabler Plugin to Remove XLM Link in WordPress Blog Header WLWManifest Disabler Įskiepis pašalinti XLM Link WordPress blog antraštė
- AdSense and Display Banner Ads Rotation in WordPress Blog or Websites AdSense ir rodyti BANNERIS skelbimai sukimosi į WordPress blog ar Tinklalapiai
- Integrate and Display Google AdSense for Search and Co-Op Custom Search Engine Results in WordPress Blog Page Template Integracija ir Rodyti Google AdSense for Search "ir Co-op individualizuotos paieškos rezultatai WordPress blog šabloną
- Change and Reset MySQL root Password Kaitos ir naujo MySQL root Password
- Paginating or Split WordPress Post or Page with NextPage in WordPress Not Working Paginating ar Splitas WordPress Skelbti arba su Nextpage į WordPress neveikia










































November 22nd, 2008 10:20 Lapkritis 22, 2008 10:20
THANK YOU SO MUCH! Thank you so much!
WordPress is running so much faster now! WordPress veikia daug greičiau dabar!
I am running all on Windows Server 2008 with: Aš einu visos Windows Server 2008:
- MySQL Server v5.0 x64 (on dedicated server) - MySQL Server V5.0 x64 (on this server)
- IIS7 with FastCGI z32 (on dedicated server) - IIS7 su FastCGI z32 (on this server)
Regards, Linkėjimai,
raja Raja
September 27th, 2007 22:14 Rugsėjis 27, 2007 22:14
This seemed to do the trick for. Tai, atrodo, tai pavyko dėl. Thanks so much for the info! Thanks so much for the info!