Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Andrew Martin's Blog:
Serving PHP session files from a RAM based disk (tmpfs) for AWS Micro Instance
Oct 06, 2011 @ 16:42:36

Andrew Martin has a new post to his blog looking at a technique that could be used to help minimize some of the performance issues you could see on AWS micro instances dealing with PHP session handling. His alternative is serving them from a RAM-based disk instead.

It’s rare to find a web server with slow disk I/O performance, but Amazon’s EC2 micro-instances are one such example. Their EBS disk subsystem access is rated "low", and this can have a detrimental effect on HTTP throughput. [...] This leaves sessions, which can be written to a redundant and fault tolerant storage system. [...] In order to speed up the disk access, a RAM-based disk can be mounted over the session directory. This has the disadvantage of being volatile – the data is lost in case of a server reboot, or the mount point being unmounted. However if tolerable, storing sessions in RAM insulates the application from poor filesystem performance.

He mentions the two types of kernels that can be used, ramfs and tmpfs, and the specifics of using a tmpfs filesystem to implement the technique (complete with command line calls to make it happen).

tagged: session files ram disk tmpfs storage performance

Link:

DevShed:
Cache Data in RAM with PHP
Jun 08, 2011 @ 15:48:23

DevShed has posted a new article in their series looking at storage interfaces and how to use them. In this latest article they show how to create a caching layer that will allow you to work with any sort of caching backend you'd like.

As with other elements of object-oriented programming, it’s possible to use segregated interfaces in a great variety of scenarios and conditions and, therefore, enjoy the benefits that they provide right out of the box. [...] My goal in this article is to create an extendable caching system based on the contract defined by a segregated interface. To achieve this, the first step we need to take is to create the interface in question.

He shows how to create the "CacheableInterface" that provides the structure for the child interfaces to follow. It provides methods for setting, getting, deleting and checking to see if a key exists. They illustrate its use with an interface to an APC cache, a file caching and a class that uses dependency injection to define the interface to use.

tagged: caching data ram tutorial apc filesystem interface

Link:

Kevin van Zonneveld's Blog:
Revisiting Faster PHP Sessions
May 06, 2011 @ 15:49:23

Kevin van Zonneveld has a new post to his blog revising an older post talking about session management with PHP and how limit the resources needed by them. In this post he points out another method - holding the sessions in RAM rather than on disk.

sing 2007 article Create turbocharged storage using tmpfs, we can defeat some of this over-engineering and take a simpler approach to speeding up sessions in PHP. We'll store them decentralized in memory by mounting RAM onto the existing /var/lib/php5 session directories throughout your application servers, which I will call nodes from now on.

He includes the commands you'll need to make a directory live in the RAM of your machine and how to migrate the existing sessions to this new data store. He covers some of the advantages of this approach (including that there's "less tech" involved so it's easier to manage). There is one point of failure he points out - that it wouldn't be a solution you could use for websites that might need to bridge sessions across machines.

tagged: faster sessions ram resource decentralize

Link:

Mike Willbanks' Blog:
PHP Performance Series: Caching Techniques
Feb 27, 2008 @ 16:25:00

On his blog today, Mike Willbanks has started up a new series that will look at various caching techniques that are available to PHP developers now:

Welcome to the first edition of the PHP performance series, a new series that I will be explaining ways to gain efficiencies and squeezing more performance out of your applications. This first edition, caching techniques, focuses on ways to cache data to optimize your current sites. Some of the concepts here are fairly easy to implement while others may take strategic design in the architecture of your application.

The methods he looks at this time are:

  • Opcode Caching
  • File Priming
  • Caching Variables
  • File Caching
  • Memory Caching
  • Database Memory Tables
  • RAM Disk
tagged: performance series caching technique opcode file database ram

Link:


Trending Topics: