Monday Apr 27, 2009

DTrace probes within MySQL 5.1 in OpenSolaris Web Stack

With the recent release of OpenSolaris 2009.06 build 111a , you will notice that MySQL 5.1 is integrated within AMP meta cluster. What this means is that now after installing OpenSolaris 2009.06, you can now easily install MySQL 5.1, Apache 2.2.11 and PHP 5.2.9 components by using either Package Manager or running the following command from the command line window :

pfexec pkg install amp

For more back ground on how to install these components on OpenSolaris, check out my earlier this and this link.

DTrace probes within MySQL 5.1

One of the goals of Open Solaris Web Stack project , that I am currently involved with, has been to enhance the number of static probes within open source web tier components like Apache, MySQL, PHP and Ruby . This is to provide the web administrators with complete end to end "under the hood" monitoring functionality. With the upcoming release of OpenSolaris 2009.06, we are making more progress along these lines - now  MySQL 5.1 includes static DTrace probes that are back ported from MySQL 6.0 source tree. For detailed information on these probes, please refer to MySQL 6.0 DTrace probe reference. Similarly, PHP 5.2.9 within OpenSolaris PHP runtime also now includes enhanced static DTrace probes as well. Ah, if you wonder on the status of Ruby, Ruby DTrace probes is already integrated within Ruby in OpenSolaris !.

Coming back to MySQL 5.1 DTrace probe , the title of my blog today, I thought, it is worthwhile to mention some of the few probes that are made available for MyISAM Key cache (but is still undocumented..)

\* keycache-read-start (filepath, bytes, mem_used, mem_free)  -> This probe is fired at the start of key cache read operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used
  4. memory available

\* keycache-read-done(mem_used, mem_free) -> This probe is fired at the end of keycache read operation.

\* keycache-read-block(bytes) -> This probe is fired if MyISAM key cache performs a blocked read from key cache.

\* keycache-read-hit / keycache-read-miss -> This probe is appropriately fired whether a given request is available within MyISAM key cache file .

\* keycache-write-start(filepath, bytes, mem_used, mem_free) -> This probe is fired at the start of key cache write operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used of the current key cache
  4. memory available

\* keycache-write-block(bytes) -> This probe is fired while performing blocked key cache write operation. 

\* keycache-write-end(mem_used, mem_free) -> This probe is fired at the end of keycache write operation.

Wednesday Apr 08, 2009

How to check your APC / Memcache performance statistics ...

PHP runtime within OpenSolaris includes performance booster extensions like APC (PHP extension to cache the compiled PHP script) and Memcache (PHP extension to integrate with Memcached server) to deliver the best performance, out of the box,  for production environment. Now, with upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 111 or above), we have also have made it easy to check out the performance statistics of these extensions which should further help you in getting the maximum juice from your system.

Installing OpenSolaris 2009.06 (preview build)

If you haven't tried OpenSolaris distribution yet, you can pick up the latest OpenSolaris 2009.06 (preview build) ISO image from here. and steps to install AMP (Apache, PHP and MySQL) stack within OpenSolaris is covered in my earlier blog .

Assuming, you have got a working AMP stack on your system and an application like Joomla, Drupal, or MediaWiki working fine , then here is what you need to do to display the performance statistics of these extensions to your browser :


For displaying PHP APC statistics to the browser:

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-apc-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-memcache-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> svcadm restart http:apache22


Now, you should be able to access these statistics of APC and Memcache extensions by going to the http://localhost/stats/apc/ or http://localhost/stats/memcache/  respectively.

Tuning PHP APC

Once configured, APC statistics page , for example, would show this below page. 

This page should provide you with information as to how many PHP pages are cached and if the cache is getting missed etc. If you see frequent APC cache misses etc then you will need to appropriately increase APC shared memory size. You could do this and other APC configuration tuning by visiting PHP APC configuration page .

If you run into any issues, you could always write to us visiting at this link or by visiting our forum.


Sunday Apr 05, 2009

New DTrace probes within PHP in OpenSolaris 2009.06

Wez Furlong wrote a PECL extension to provide a DTrace probe within PHP more than 4 years back. As part of Web Stack project within OpenSolaris, this extension has been made available within Solaris 10 as well as in OpenSolaris distribution in the last year or so. 

Now, with the upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. See my earlier blog on this topic. Besides PHP version update, David Soria Parra - contributor within open source projects like Mercurial, PHP Web Stack has made  this (experimental) patch available to provide the following additional DTrace probes within PHP for this release :

\* compile-file-entry / compile-file-return -> This proble wil fire whenever Zend engine need to compile a given PHP script and can provide information as to which PHP script is currently going through PHP compilation process along with start and end line number. Note: PHP engine within OpenSolaris includes APC PECL extension - which caches the compiled PHP script when requested again and hence this probe will not fire in that circumstance.

\* function-entry / function-return -> This probe will fire whenever Zend engine is executing a PHP function and can provide information as to which PHP function along with its file name and line number is currently being executed by PHP Zend engine.

\* execute-entry / execute-return -> This probe will fire while executing PHP script and can provide information as to which file, line number is currently being executed by PHP Zend engine.

\* exception-thrown / exception-catched -> This probe gets fired whenever PHP runtime encounters an exception and can the classname when an exception is thrown.

\* error -> This probe gets fired whenever PHP runtime throws an error and can provide information like the error message, file name in which the error happened and the corresponding line number.

\* request-startup / request-shutdown  -> This probe gets fired at the start and end of processing a given PHP script and can provide the filename of the script , request URI . This should allow a given DTrace script to track the start and end of PHP script. 

Note:  this patch is under active development and will be further refined to add additional DTrace probes as well as to address any user reported issues. 

Considering that DTrace support is available for Mac as well as FreeBSD, I am sure, PHP community will be interested into looking into this patch as well.

Okay, so now, if you are interested in trying out OpenSolaris 2009.06 (preview build) and the updated AMP stack, check out my earlier  blog for detailed steps on this.

Here is a sample DTrace script that you can use as a reference point.

Friday Mar 27, 2009

Configuring Sun Web Server 7 with PHP runtime in OpenSolaris

With upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. Also, we have integrated a configuration script to simplify the steps required to configure PHP runtime with Sun Java System Web Server 7 (formerly known as Sun ONE/iPlanet Enterprise Server). Thought, I would you walk through the steps involved here

Installing PHP 5.2.9 in OpenSolaris 2009.06 (preview build)

Check out my earlier blog on how to get PHP 5.2.9 runtime within OpenSolaris 2009.06 on your system.

Installing Sun Web Server 7

Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out our performance benchmarks. You can download and install the latest version of Sun Java System Web Server from here .

If you are adventurous, you can also build the open sourced version of this beast (available under BSD license) by following the instructions provided here

If you would like a little hand holding in installing our product, check out this nice demo . Hope, you are able to successfully install Sun Web Server 7 with the help of this demo. If not, you can always post your questions in our forums - where we developers will be happy to help you out !.

Note1: You will need to install Java development environment within your OpenSolaris before proceeding to install Sun Web Server 7 on OpenSolaris . You could do this by running the following command from the command line window

sriramn@sriramn:~> pfexec pkg install java-dev

Note2:  You will need to perform Web Server installation as 'root' (or use pfexec ./setup)  and choose Web Server runtime user as 'webservd'. Please check out this  blog   for more information on installing Web Server 7 on OpenSolaris.

Finally, let us hook up PHP runtime within Sun Web Server 7. To do this, run the following script (which is newly available from OpenSolaris 2009.06 preview build 110 or above)

sriramn@sriramn:~> pfexec /usr/php/5.2/samples/scripts/configure-sun-webserver --installroot=/sun/webserver7 --instancename=https-sriramn

  \* where /sun/webserver7 is the location of the Web Server 7 top level installation location. Provide the appropriate location as in your case.

  \* and https-sriramn -> is the instance created under this installation. The instance name is typically the name of your hostname. You need to provide the appropriate value here.

Now, you will need to restart the Web Server 7 instance by running these below commands so that the newly modified changes can be loaded.

sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/stopserv
sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/startserv

Sun Web Server 7 is now ready to serve any PHP pages within its document root. For example, to deploy Joomla or Drupal, all you need to do is unpack these application tar balls under  /sun/webserver7/https-sriramn/docs/ and point your browser to http://localhost/joomla etc.

Now, you could write few PHP script within Web Server document root directory (<install-root>/<instance-name>/docs) and test our your configurations. If you are satisfied then we now need to move to the final step.  Web Server 7 Administration server need to be told of what we just did. This is accomplished easily by running these following CLI commands

sriramn@sriramn:~> pfexec chown webservd:webservd /sun/webserver7/https-\*/config/\*obj.conf

sriramn@sriramn:~> /sun/webserver7/bin/wadm pull-config --user=admin --config=sriramn sriramn.sun.com

where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Note: Web Server 7 integrates a Java web container within its default server instance. Having an integrated web container will  allow you to deploy Java Web Applications like JSP, Servlet etc. Hence, Sun Web Server has to load Java runtime as part of server startup - eating your previous CPU and memory resource. Now, if you plan on using only PHP runtme, you can easily disable Java Web Container by running he following commands :

sriramn@sriramn:~> /sun/webserver7/bin/wadm disable-java --user=admin --config=sriramn sriramn.sun.com

sriramn@sriramn:~> /sun/webserver7/bin/wadm deploy-config --user=admin  sriramn.sun.com

again where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Hope you will like our simplified integration and let us know with your feedback at our forum.

About

Sharing what little I know

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today