• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » MySQL Persistent Connection to Optimize WordPress

By Abhishek Ghosh February 29, 2012 11:38 pm Updated on December 26, 2021

MySQL Persistent Connection to Optimize WordPress

Advertisement

MySQL Persistent Connection can be used to Optimize WordPress Page Loading Speed. It depends on server configuration, otherwise performance will degrade. By default, MySQL Persistent Connection is not enabled in WordPress. We can, however force WordPress to use MySQL Persistent Connection. Here is how to force WordPress to use MySQL Persistent Connection, what should be the monitoring tools and on what Server Configuration MySQL Persistent Connection probably work better.

 

What is MySQL Persistent Connection

 

When we are using non persistent connection, every time WordPress MySQL queries are opening and closing the database connection. This function to some extent remains even when we use a Cache Plugin. Because there are some PHP calls which are not Cached. Sometimes we force with HTML comments to make it work as live, non cached. But in case of forced  MySQL Persistent Connection usage, when connecting to the database, the call / function will try to find an already opened with the same username and password. So, if one connection is already made before, it will not require to check the username and password. So logically using  MySQL Persistent Connection can at least work better for backend of the WordPress, not if frontend.

 

How to force  MySQL Persistent Connection in WordPress

 

Basically editing one file in wp-includes folder. That file is wp-db.php ; there are three lines (in WordPress 3.3.1) where mysql_connect() has been used. If we replace these with mysql_pconnect() then we are basically forcing MySQL Persistent Connection. Actually editing only @mysql_connect will serve the purpose. MySQL is a very big ocean and I have very little knowledge about MySQL, I think it is better to change all the three mysql_connect to mysql_pconnect to force MySQL Persistent Connection.

Advertisement

---

 

For whom MySQL Persistent Connection will work better

 

Just like we are using a server platform with virtually no limit of physical RAM and our PHP memory can be increased for WordPress to any digit. If there is very less PHP memory then forcing MySQL Persistent Connection will return 500 server error. You will get these in your PHP error log.

 

Tools to check health and performance after forcing MySQL Persistent Connection

 

First tool to check the efficiency of MySQL Persistent Connection is webpagetest.org – to check the Page Loading Speed after forcing MySQL Persistent Connection. Second is your PHP error log to check errors after using MySQL Persistent Connection.

 

Our test and result with MySQL Persistent Connection

 

We have tested this MySQL Persistent Connection on 5 WordPress installation with medium to quite high traffic. We have noted almost no difference in page loading speed after forcing MySQL Persistent Connection. To show you the performance after forcing MySQL Persistent Connection, here are two screenshots (like those hair growing lotion adverts!) :

 

Here is the performance before forcing MySQL Persistent Connection :

 

MySQL Persistent Connection
Here is the performance after forcing MySQL Persistent Connection :

after MySQL Persistent Connection to Optimize WordPress

Inference on MySQL Persistent Connection for WordPress

 

You can check our one of other site Daily Medico ; we kept the forced MySQL Persistent Connection on for this one. Its loading very fast on ‘feel’ – within 1.3 seconds but the problem is there are PHP errors are also getting generated. So the crux is probably forcing MySQL Persistent Connection even on high end cloud server with loadbalancers is not very safe although it might increase the page loading speed a bit, at least the ‘feel’ becomes ‘its loading faster’.

 

Signature Tagged With wordpress mysql optimization , wordpress persistent database connection , wordpress optimization speed , wordpress database connection limit , PHP MySQL Allow Persistent Connections: On , Persistent Connection wordpress , persistent connection updater wordpress , persist connection to database on wordpress , optimize wordpress website speed , optimize mysql server for wordpress

This Article Has Been Shared 539 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to MySQL Persistent Connection to Optimize WordPress

  • WordPress VIP : Is it a solid rip for the Enterprise

    WordPress VIP is luxurious complete solution at high price range. Let us us test WordPress VIP’s performance with non WordPress VIP WordPress.

  • XAMPP : The Easiest Software To Install LAMP

    XAMPP is a compilation of free software in the context of the LAMP system. XAMPP makes it easy to install and configure Apache, MySQL, PHP and others.

  • Twitter Bootstrap Guide For Newbies

    Twitter Bootstrap guide is written in a way, so that the basic users can use Free Twitter Bootstrap Source Code and use customize for own website design.

  • CDN Options : Rackspace Cloud Files Vs Amazon CloudFront

    CDN options are quite challenging now to decide which has better performance. This article compares Rackspace Cloud Files with Amazon Cloud Front.

  • List of Open Source Forum Softwares Based on PHP MySQL

    List of Open Source Forum Softwares Based on PHP MySQL shows some free yet powerful forum softwares for your main domain or on subfolder or subdomain.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Configuration Management February 5, 2023
  • What is ChatGPT? February 3, 2023
  • Zebronics Pixaplay 16 : Entry Level Movie Projector Review February 2, 2023
  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023

About This Article

Cite this article as: Abhishek Ghosh, "MySQL Persistent Connection to Optimize WordPress," in The Customize Windows, February 29, 2012, February 6, 2023, https://thecustomizewindows.com/2012/02/mysql-persistent-connection-to-optimize-wordpress/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT