• 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 February 29, 2012

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 899 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic 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.

  • Tips to Optimize WordPress Running on Dedicated Server

    Tips to Optimize WordPress Running on Dedicated Server gives you the most commonly missed optimization tips to smoothen the performance and page loading speed.

  • 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

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

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 (20K Followers)
  • Twitter (4.9k Followers)
  • Facebook (5.8k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.2k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Software Modernization? January 21, 2021
  • Cloud Computing : Cybersecurity Tips for Small Business Owners January 20, 2021
  • Arduino : Independently Blink Multiple LED January 18, 2021
  • What is a Loosely Coupled System? January 17, 2021
  • How To Repack Installed Software on Debian/Ubuntu January 16, 2021

 

About This Article

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

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

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

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

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