EzineArticles - Expert Authors Sharing Their Best Original Articles



  Submit Articles
  Members Login
  Benefits
  Expert Authors
  Read Endorsements
  Editorial Guidelines
  Author TOS

  Terms of Service
  Ezines / Email Alerts
  Manage Subscriptions
  EzineArticles RSS

  Blog
  Forums
  About Us
  What's New
  Contact Us
  Article Writing Shop
  Advertising
  Affiliates
  Privacy Policy
  Site Map


Advanced Search


Would you like to be notified when a new article is added to the Web-Development category?

Email Address:


Your Name:


Prefer RSS?
Subscribe to the
Web-Development
RSS Feed:

PHP Caching - A Great Way To Super Charge Your Server
Print This Article Ezine Publisher Send To Friends Add To Favorites Post A Comment Suggest Topic Report Author

To run a high performance PHP/MySQL server, one has to keep a close eye on the server load. A high performance mechanism to drastically reduce loads is caching. A system that effectively employs caching exhibits much higher performance and less downtime. MySQL includes mechanisms for caching via MySQL's Query Cache. At the same time, this caching system does not improve performance if any of the rows in a large table are altered, so there is no 'row level' caching in MySQL, only 'table level' caching.

So how do we deal with this issue? The solution lies in using one of the caching systems available to PHP. One that I have used to great satisfaction is Cache Lite, which, under PHP program control, caches data to hard disk for a period of time as specified by the program.

So lets take a look at Cache Lite and see how it is incorporated into the overall PHP script design. First, search for and download Cache Lite. Then save the files under 'Lite' directory to a subdirectory under your webserver's root (e.g. 'Cache/Lite'). After that, you can refer to the example file in the downloaded documentation (the file is called 'examples'), which provides a working example, and that information is not repeated here.

Here I will concentrate on cases of use. Take a bulletin board, for example. Moderator information is kept in users table, and that table can get large. Normally the moderator information does not change often. In this case, table-level caching available in MySQL does not provide performance improvements when any changes are made in the users table. Instead, a cache can be set up with PHP to cache all the moderator information for say 24 hours.

The above approach works great, but there is a tradeoff. What if a moderator is added or dropped, or some other information related to this moderator is changed. In this case, we have to add PHP code to delete/refresh the cache, or to make the cache timeout reasonable short (say 10 minutes).

Another point to keep in mind is with Linux directory access control, we need to do a 'chmod 777' for the directory that keeps the cache data. This will enable PHP to read/write from/to that directory.

In summary, PHP can easily be supercharged to deliver performance in demanding environments. PHP can also overcome for the current shortcoming of MySQL which is lack of row-level caching.

Visit dbFreaks for php, MySQL, and other database discussions. The following threads are of interest: PHP Installation Problems on XP discusses issues with PHP installation on Windows XP computers. MySQL Join Queries and PHP Security Questions are other interesting threads related to MySQL/PHP installs.

Article Source: http://EzineArticles.com/?expert=Steven_Kay

Other Recent EzineArticles from the Internet-and-Businesses-Online:Web-Development Category:

Most Viewed EzineArticles in the Internet-and-Businesses-Online:Web-Development Category (90 Days)

  1. How to Create a Web Page Shadow Using Photoshop Slice Tool and HTML Coding
  2. Find Out the Best Free Website Creator
  3. Make Your Own Websites - What You Should Know
  4. Choosing Java Vs .Net For Web Development
  5. How to Put Hyperlink in an Image to Create a Clickable Picture!
  6. Under Construction Website - Create an Under Construction Web Page to Protect Yourself !
  7. How Much Does a Website Cost - An Inside Look From a Web Designer
  8. Creating Web Pages With PHP, CMS, and Joomla
  9. How to Create an HTML Image Background For Your Webpage
  10. Start My Own Website - Make Millions While I Sleep
  11. Build My Own Website in 2 Easy Steps
  12. How to Write Specifications For a Website
  13. Add a Flash Event Calendar to Your Website
  14. The Best Free Website Builder Service on the Internet
  15. Understanding the Basics of Owning Your Own Website

Most Published EzineArticles in the Internet-and-Businesses-Online:Web-Development Category

  1. Make a Website Free - 5 Benefits of Building a Website For Your Online Business
  2. 4 Reasons Why Its Important to Have a Website For Your Business - Or You Will Not Make Any Money
  3. Understanding the Basics of Owning Your Own Website
  4. How to Build a Website - Know More About It
  5. Make Your Own Website the Quick and Easy Way - Without Sacrificing Quality Or Options
  6. Make Money Online - Landing Page Creation
  7. How to Design a Social Networking Website
  8. Marketing Your Website Online
  9. Web Development Estimation
  10. Top 6 Website Basics You Must Know
  11. Under Construction Website - Without an Under Construction Web Page You Are in DANGER!
  12. Photography Website Music and Why it Hurts Your Business
  13. Creating Your Website - What You Need to Do to Make it LIVE!
  14. How to Build a Small Business Website For Less Than $100
  15. Photography Website How to For the Professional Photographer

 

This article has been viewed 72 time(s).
Article Submitted On: May 20, 2008



© EzineArticles.com - All Rights Reserved Worldwide.