Using PHP-MySQL Persistent Connections to Run WordPress Blog שימוש ב-MySQL PHP Persistent Connections כדי הפעלה בלוג WordPress

When connecting to MySQL database, WordPress weblog based on PHP scripting will use non-persistent connection by default. בעת חיבור אל מסד הנתונים MySQL, WordPress weblog מבוסס על PHP scripting ישתמש ללא חיבור מתמיד כברירת מחדל. 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. כלומר, וורדפרס יפעילו PHP כדי ליצור חיבור חדש שרת MySQL לכל בקשה הדף הדינאמי, ולאחר מכן לסגור את החיבור פעם באתר דף אינטרנט הבניין תושלם. Repetitive opening and closing of MySQL connections causes overheads and uses up precious CPU, memory and system resources on the web host. חוזרים פתיחת וסגירת חיבורים MySQL גורם תקורה ומשתמש את המעבד היקר, הזיכרון ואת משאבי המערכת במחשב המארח של האינטרנט.

Using persistent connection to connect to MySQL database server is not always a good option. באמצעות חיבור מתמיד להתחבר אל שרת מסד הנתונים MySQL, לא תמיד אפשרות טובה. 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. כל החיבורים לוקח את המשאבים, כולל זיכרון, מאגרים, שולחן או פתיל מצבורי פנימי ב MySQL ו ארובות, או לפתוח קבצים IO פעילות ברמת מערכת ההפעלה. 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. לכן כאשר הרבה קשרים עקביים הם פתחו אבל לא סגור לאחר שהושלמו העסקות, על משאבי המערכת עשויה לרוקן מעלה לפגוע בביצועים של שרת אינטרנט, או במקרה הגרוע ביותר, לגרום לכישלון HTTP. 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. יתרה מכך, אם חיבור מתמיד היא נעצרה, פעיל או הפך שבק חיים או כבר לא בשימוש, זה לא הסתיים, ואת שרת MySQL רק לסגור אותה כדי לשחרר את המשאב שנכבשו על ידי החיבור לאחר כ 28800 שניות (8 שעות) כברירת מחדל אלא אם שינה את פסק הזמן של פרמטרים ב קבצי תצורה my.cnf. 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. זה כמה גורמים עלול להביא צרות כגון MySQL DB מסרב קשרים חדשים או שרת איטי אם היישומים לא טיפלו כראוי קשרים מתמיד. Thus if you're not experience webmasters, please do not attempt to change Wordpress to use persistent connections. לכן, אם אתה לא Webmasters ניסיון, בבקשה אל תנסו לשנות Wordpress להשתמש קשרים מתמיד.

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. עם זאת, עבור בלוגרים שיש להם בלוג עסוק גדול, מול האילוצים שדרוג מערכת האינטרנט המארח מפרטים, ואת לא רוצה להשתמש דף סטטי במטמון תוסף כגון WP-cache, חיבור מתמיד הוא אפשרות כניסה כדי לכוון ולבצע אופטימיזציה של שרת אינטרנט כדי לראות אם ניתן שירות אינטרנט מהיר. Persistent connection allows connection to be open once and will not be closed when the execution of the script ends. חיבור מתמיד מאפשר חיבור יהיה פתוח פעם ולא תהיה סגורה כאשר ביצוע של הסקריפט מסתיים. Instead, the link is kept in pool and will remain open for future use. במקום, הקישור נשמרת הבריכה תישאר פתוחה לשימוש עתידי. Thus, using persistent connections will eliminate the process of opening and closing the connection. כך, באמצעות חיבור מתמיד יבטל את התהליך של פתיחת וסגירת החיבור. 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. הדבר יגרום בעקיפין להפחית חיבור MySQL בנושא תקורה כגון שרת אימות להקים חיבור שבו הוא זקוק רק פעם אחת, הצלת תעבורת רשת נוסף, השתמש ומשאבים לטפל חיבור נוסף. 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. ליד, יכול להיות שיש כמה מצבורי ברמת החיבור, אשר צריך להיות מלא עד לביצוע תקין, ואולי להקטין את מספר החיבורים למסד הנתונים.

By default, WordPress is using mysql_connect() function that establishes a new database connection on every page. כברירת מחדל, וורדפרס היא בעזרת mysql_connect () function כי חיבור מסד נתונים חדש בכל עמוד. 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. תכונת חיבור מתמיד ידרוש mysql_pconnect () פונקציית ה-API שבו משתמש בדיוק, אבל יש חיבור מובנה איחוד לשמור על קשרים חי בין בקשות. So to switch to use persistent connection to run WordPress, the mysql_connect() function has to be replaced with mysql_pconnect(). אז כדי לעבור להשתמש חיבור מתמיד לרוץ וורדפרס, את mysql_connect () function יש להחליף עם 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. כדי להפעיל ולהשתמש קשרים עקביים עם וורדפרס, פשוט הכניסה לארח האינטרנט שלך עם SSH (או Telnet ביטחון), ולשנות לספרייה הביתה Webroot שם בלוג WordPress מותקן. Then change directory into wp-includes directory. ואז לשנות את wp-המדריך כולל המדריך. Inside the wp-includes directory, there is wp-db.php file. בתוך wp-כולל ספרייה, יש קובץ wp-db.php. Use any text editor such as vi to edit wp-db.php. השתמש בעורך טקסט כלשהו כגון השישי כדי לערוך wp-db.php. Search or locate the function of mysql_connect (or @mysql_connect ). חיפוש או לאתר את הפונקציה של mysql_connect (או @ mysql_connect). There is only one instance of mysql_connect. יש רק מופע אחד של mysql_connect. Just change the mysql_connect to mysql_pconnect , then save and exit the wp-db.php. רק כדי לשנות את mysql_connect mysql_pconnect, ואז לשמור ולצאת 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 ו-PHP (כל עוד אתה לא מכבה את mysql.allow_persistent ב php.ini) מיד להשתמש בחיבורי עיקש כדי להתחבר מסד נתונים MySQL. It's worth to try out which setting is best for your environment. כדאי לנסות את אשר ההגדרה הטובה ביותר עבור הסביבה שלך.

IMPORTANT : The page is machine translated and provided "as is" without warranty. חשוב: הדף מכונת תירגם מתפרסם "כמות שהוא" ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to נא עיין original English article המאמר המקורי באנגלית whenever possible. בכל הזדמנות אפשרית.


3 Responses to “Using PHP-MySQL Persistent Connections to Run WordPress Blog” 3 תגובות ל "שימוש ב-MySQL PHP Persistent Connections כדי הפעלה בלוג WordPress"

  1. Out החוצה
    September 23rd, 2009 14:37 23 ספטמבר 2009 14:37
    3 3

    Thanks a lot.I really do not know about the function mysql_pconnect().Will going to implement it practically soon. תודה lot.I באמת לא יודע על הפונקציה mysql_pconnect (). האם הולך ליישם אותו ממש בקרוב.

  2. raja ראג 'ה
    November 22nd, 2008 10:20 22 נובמבר 2008 10:20
    2 2

    THANK YOU SO MUCH! תודה רבה!
    WordPress is running so much faster now! וורדפרס הוא רץ כל כך הרבה יותר מהר עכשיו!

    I am running all on Windows Server 2008 with: אני מפעיל את כל Windows Server 2008 עם:
    - MySQL Server v5.0 x64 (on dedicated server) - MySQL Server V5.0 x64 (בשרת ייעודי)
    - IIS7 with FastCGI z32 (on dedicated server) - IIS7 עם FastCGI z32 (בשרת ייעודי)

    Regards, דרישת שלום,
    raja ראג 'ה

  3. Edward אדוארד
    September 27th, 2007 22:14 27 ספטמבר 2007 22:14
    1 1

    This seemed to do the trick for. זה נראה בשביל לעשות את הטריק. Thanks so much for the info! תודה רבה על מידע!

Leave a Reply השאירו תגובה

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> באפשרותך להשתמש בתגים אלה: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. כדי להירשם הערות תכונה הושבת. To receive notification of latest comments posted, subscribe to כדי לקבל הודעה העדכנית של תגובות, כדי להירשם My Digital Life Comments RSS feed החיים שלי דיגיטליות תגובות RSS Feed or או register to receive הרשמה לקבלת new comments in daily email digest. תגובות חדש ב דוא"ל תקציר יומי.
Custom Search

New Articles מאמרים חדשים

Incoming Search Terms for the Article תנאי נכנסות חיפוש עבור מאמרים

mysql persistent connection חיבור מתמיד MySQL - -- MySQL persistent connections קשרים MySQL מתמשך - -- wordpress persistent connections WordPress קשרים מתמשך - -- php mysql persistent connection PHP MySQL חיבור מתמיד - -- php mysql wordpress WordPress MySQL PHP - -- wordpress mysql connection WordPress חיבור MySQL - -- wordpress persistent connection WordPress חיבור מתמיד - -- php persistent connections קשרים מתמשך PHP - -- mysql persistent MySQL מתמשך - -- php mysql persistent connections קשרים PHP MySQL מתמשך - -- php mysql persistent עקשנית MySQL PHP - -- persistent connection mysql MySQL חיבור מתמיד - -- WORDPRESS PHP MYSQL WORDPRESS PHP MYSQL - -- persistent connections mysql קשרים מתמשך MySQL - -- wordpress mysql_connect WordPress mysql_connect - -- wordpress mysql timeout WordPress MySQL פסק זמן - -- mysql_pconnect wordpress WordPress mysql_pconnect - -- php persistent connection חיבור מתמיד PHP - -- Reduce or eliminate persistent connections to reduce connection usage להפחית או לחסל קשרים מתמשך לצמצום השימוש חיבור - -- mysql persistent links קישורים מתמשך MySQL - -- wordpress mysql_pconnect WordPress mysql_pconnect - -- wordpress mysql persistent connection WordPress חיבור מתמיד MySQL - -- persistent connection חיבור מתמיד - -- mysql connections קשרים MySQL - -- wordpress mysql connect WordPress MySQL להתחבר - -- persistent connections wordpress קשרים מתמשך WordPress - -- mysql persistent connection performance ביצועי חיבור MySQL מתמשך - -- persistent mysql MySQL מתמשך - -- php persistent mysql connection חיבור מתמשך MySQL PHP - -- mysql php persistent connection חיבור מתמשך MySQL PHP - -- wordpress mysql persistent connections WordPress קשרים מתמשך MySQL - -- persistent connection mysql php PHP MySQL חיבור מתמיד - -- wordpress connection pool בריכת חיבור WordPress - -- wordpress db connection חיבור db WordPress - -- mysql_connect wordpress WordPress mysql_connect - -- wordpress connection pooling חיבור WordPress וריכוז - -- php persistent mysql PHP MySQL מתמשך - -- mysql allow persistent MySQL לאפשר מתמשך - -- persistent connection php php חיבור מתמיד - -- persistent mysql connection חיבור MySQL מתמשך - -- wordpress persistent mysql WordPress MySQL מתמשך - -- mysql persistent connection php PHP MySQL חיבור מתמיד - -- mysql connect persistent MySQL להתחבר מתמשך - -- wordpress database connection pool חיבור מסד נתונים WordPress הבריכה - -- connection mysql php חיבור MySQL PHP - -- php mysql connection pooling חיבור MySQL PHP וריכוז - -- wordpress persistent db WordPress db מתמשך - -- Wordpress connection to MySQL חיבור ל-MySQL Wordpress - -- mysql.allow_persistent wordpress WordPress mysql.allow_persistent - -- php mysql persistant connection PHP MySQL חיבור מתמיד - --