Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 30 of 91 Next 30 Older Entries

Displaying posts with tag: PHP (english) (reset)

New plugin: Connection multiplexing with PHP and MySQL
Employee +4 Vote Up -0Vote Down

Here comes the next open source mysqlnd plugin prototype: PECL/mysqlnd_mux. The PHP mysqlnd connection multiplexing plugin shares a connection to MySQL between multiple user connection handles. Connection multiplexing aims to reduce connect time and lowers the total number of concurrenly opened connections. The first is primarily a benefit for the client, the latter is great for the server. Multiplexing may be most desired in environments with many short-lived connections and weak client-side pooling - such as a PHP web application.


PHP mysqlnd connection multiplexing plugin . More about

  [Read more...]
PHP: Transparent load balancing and sharding with mysqlnd
Employee +4 Vote Up -0Vote Down

Psst, you want some client-side MySQL load balancing with and without sharding for your PHP application? PHP 5.3 has something to offer for you. It is free. It requires no to very little changes to your applications. It is open source but works with closed source applications as well. You won’t find this information in any book, because some book authors still do not cover "mysqlnd". Read on for 30+ lines of PHP to add round-robin connection load balancing and, 70+ lines of PHP to add MySQL master slave replication or sharding support to your application without changing the application. Black magic from Manmuckiel.

The goal

Round-robin connection load balancing

Client   Server connect(‘Host A’) mysqlnd plugin
30+ lines PHP ->
  [Read more...]
PHP: Transparent load balancing and sharding with mysqlnd
Employee +0 Vote Up -0Vote Down

Psst, you want some client-side MySQL load balancing with and without sharding for your PHP application? PHP 5.3 has something to offer for you. It is free. It requires no to very little changes to your applications. It is open source but works with closed source applications as well. You won’t find this information in any book, because some book authors still do not cover "mysqlnd". Read on for 30+ lines of PHP to add round-robin connection load balancing and, 70+ lines of PHP to add MySQL master slave replication or sharding support to your application without changing the application. Black magic from Manmuckiel.

The goal

Round-robin connection load balancing

Client   Server connect(‘Host A’[Read more...]
PHP: the 38 characters of the mysqlnd profiler
Employee +2 Vote Up -0Vote Down

Recently I was forced to benchmark a mysqlnd plugin on Windows. X-Debug was no help. It worked flawless on Windows but it can’t tell you what goes on inside a PHP user space API call, for example, you will not know how much time mysqli_query() spends reading a result set. Very Sleepy is nice and the latest Microsoft Visual Studio profiler are probably wonderful but any of those external profiling tools did give me too fine-grained information. Also, they are external profiler which means you have to install extra software.

The mysqlnd statistics didn’t help me either. I didn’t need any aggregated values, I was curios if a certain function was the bottleneck. The solution:

  • extra statistics for critical sections in the plugin using the mysqlnd statistics framework (C coding)
  • dump
  [Read more...]
PHP: the 38 characters of the mysqlnd profiler
Employee +0 Vote Up -0Vote Down

Recently I was forced to benchmark a mysqlnd plugin on Windows. X-Debug was no help. It worked flawless on Windows but it can’t tell you what goes on inside a PHP user space API call, for example, you will not know how much time mysqli_query() spends reading a result set. Very Sleepy is nice and the latest Microsoft Visual Studio profiler are probably wonderful but any of those external profiling tools did give me too fine-grained information. Also, they are external profiler which means you have to install extra software.

The mysqlnd statistics didn’t help me either. I didn’t need any aggregated values, I was curios if a certain function was the bottleneck. The solution:

  • extra statistics for critical sections in the plugin using the mysqlnd
  [Read more...]
PHP: 62 characters to see all MySQL queries
Employee +1 Vote Up -0Vote Down

Did you ever want to see the database queries an arbitrary PHP MySQL application runs? It takes two free downloads and 62 characters to see them.

  • Get PHP 5.3.4-dev
  • Get PECL/mysqlnd_qc
  • Add 19 characters to your configure line: --enable-mysqlnd-qc
  • Add 43 characters at the end of applications source, e.g. using the auto_append_file configuration setting: var_dump(mysqlnd_qc_get_query_trace_log());
  • Start your query analysis


array(329) {
  [0]=>
  array(8) {
    ["query"]=>
    string(27) "SET @@session.sql_mode = """
    ["origin"]=>
    string(1330) "#0 /home/nixnutz/Downloads/oxid/core/adodblite/adodbSQL_drivers/mysql/mysql_driver.inc(352): mysql_query('SET @@session.s...',

  [Read more...]
PHP: 62 characters to see all MySQL queries
Employee +0 Vote Up -0Vote Down

Did you ever want to see the database queries an arbitrary PHP MySQL application runs? It takes two free downloads and 62 characters to see them.

  • Get PHP 5.3.4-dev
  • Get PECL/mysqlnd_qc
  • Add 19 characters to your configure line: --enable-mysqlnd-qc
  • Add 43 characters at the end of applications source, e.g. using the auto_append_file configuration setting: var_dump(mysqlnd_qc_get_query_trace_log());
  • Start your query analysis


array(329) {
  [0]=>
  array(8) {
    ["query"]=>
    string(27) "SET @@session.sql_mode = """
    ["origin"]=>
    string(1330) "#0 /home/nixnutz/Downloads/oxid/core/adodblite/adodbSQL_drivers/mysql/mysql_driver.inc(352):

  [Read more...]
PHP/C: Does MYSQL[I]_OPT_CONNECT_TIMEOUT work?
Employee +1 Vote Up -0Vote Down

C and PHP MySQL clients can set a connection timeout before a connection is established to MySQL. The MySQL C API manual states about MYSQL_OPT_CONNECT_TIMEOUT , which is equal to PHPs MYSQLI_OPT_CONNECT_TIMEOUT:

MYSQL_OPT_CONNECT_TIMEOUT

Connect timeout in seconds.


From: http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html

That is half of the story. The actual behaviour depends on the library you use, the operating system and the transport protocol (TCP/IP, Unix domain sockets, Windows named pipes, Shared Memory).

C users can choose between the MySQL Client Library, which ships with the MySQL server, and the





  [Read more...]
PHP/C: Does MYSQL[I]_OPT_CONNECT_TIMEOUT work?
Employee +0 Vote Up -0Vote Down

C and PHP MySQL clients can set a connection timeout before a connection is established to MySQL. The MySQL C API manual states about MYSQL_OPT_CONNECT_TIMEOUT , which is equal to PHPs MYSQLI_OPT_CONNECT_TIMEOUT:

MYSQL_OPT_CONNECT_TIMEOUT

Connect timeout in seconds.


From: http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html

That is half of the story. The actual behaviour depends on the library you use, the operating system and the transport protocol (TCP/IP, Unix domain sockets, Windows named pipes, Shared Memory).

C users can choose between the MySQL Client Library, which ships with the MySQL server, and





  [Read more...]
PHP: the mysqlnd slow query log (incl. backtrace)
Employee +1 Vote Up -0Vote Down

Sometimes you forget about what you did years ago, for example the ability of mysqlnd write back traces of slow queries into the PHP error log . Regardless if you use mysqlnd with ext/mysql, ext/mysqli or PDO_MYSQL, mysqlnd is able to tell you which of your code has executed a slow query. To enable the feature, you need to compile PHP with CFLAGS="-D A0". A0? Yeah, we must have had some doubts about the usefulness.

Slow queries

The MySQL server is capable of monitoring queries and recording slow queries in a slow query log. MySQL can log the following types of queries:

  • SQL statements that took more than long_query_time seconds to execute
  • SQL statement that required at least min_examined_row_limit rows to be examined (MySQL
  [Read more...]
PHP: the mysqlnd slow query log (incl. backtrace)
Employee +0 Vote Up -0Vote Down

Sometimes you forget about what you did years ago, for example the ability of mysqlnd write back traces of slow queries into the PHP error log . Regardless if you use mysqlnd with ext/mysql, ext/mysqli or PDO_MYSQL, mysqlnd is able to tell you which of your code has executed a slow query. To enable the feature, you need to compile PHP with CFLAGS="-D A0". A0? Yeah, we must have had some doubts about the usefulness.

Slow queries

The MySQL server is capable of monitoring queries and recording slow queries in a slow query log. MySQL can log the following types of queries:

  • SQL statements that took more than long_query_time seconds to execute
  • SQL statement that required at least
  [Read more...]
PHP: 120 tuning screws for mysqlnd
Employee +1 Vote Up -0Vote Down

The MySQL native driver for PHP (mysqlnd) is capable of collecting some 120 performance statistics. This is about twice as much as it was when I blogged about the 59 tuning screws for mysqlnd. While the basics have not not changed and the API calls for accessing the data remained the same (see previous posting) the new figures have never been described before.

The figures are for those of you who want to squeeze the last out of the PHP. Many of the statistics have been written for those who have developed mysqlnd and not for PHP users. The data is certainly still of interest for PHP experts but let me stress out again that it is for experts.

Scope

Statistics are either aggregated on on a per-connection or per-process basis. Changes to per-connection statistics also change the

  [Read more...]
PHP: 120 tuning screws for mysqlnd
Employee +0 Vote Up -0Vote Down

The MySQL native driver for PHP (mysqlnd) is capable of collecting some 120 performance statistics. This is about twice as much as it was when I blogged about the 59 tuning screws for mysqlnd. While the basics have not not changed and the API calls for accessing the data remained the same (see previous posting) the new figures have never been described before.

The figures are for those of you who want to squeeze the last out of the PHP. Many of the statistics have been written for those who have developed mysqlnd and not for PHP users. The data is certainly still of interest for PHP experts but let me stress out again that it is for experts.

Scope

Statistics are either aggregated on on a per-connection or per-process basis. Changes to

  [Read more...]
The only reliable about the PHP 5.3 schedule
Employee +0 Vote Up -1Vote Down

Time left to the PHP 5.3 Release Party:

(JavaScript countdown - less than 48 hours…)

The only reliable about the PHP 5.3 schedule
Employee +0 Vote Up -0Vote Down

Time left to the PHP 5.3 Release Party:

(JavaScript countdown - less than 48 hours…)

PHP 5.3 BBQ Release Party Munich
Employee +1 Vote Up -0Vote Down



We like to invite you to the PHP 5.3 release party which is an event to celebrate the 5.3 release, happening Friday, the 17th of July in Munich. The release party offers a chance to come together with other php enthusiasts and enjoy that php is alive and kicking. And of course people in favour of a decent barbecue, together with some beer and other drinks are invited.

The happening will take place at Waldwirtschaft beer garden, at any weather.
We will meet at 19:00 o’clock - open end.

The location is famous for its huge beer garden (2500 available seats, a children’s playground) and its




  [Read more...]
PHP 5.3 BBQ Release Party Munich
Employee +0 Vote Up -0Vote Down



We like to invite you to the PHP 5.3 release party which is an event to celebrate the 5.3 release, happening Friday, the 17th of July in Munich. The release party offers a chance to come together with other php enthusiasts and enjoy that php is alive and kicking. And of course people in favour of a decent barbecue, together with some beer and other drinks are invited.

The happening will take place at Waldwirtschaft beer garden, at any weather.
We will meet at 19:00 o’clock - open end.

The location is famous for its huge beer garden (2500 available seats, a




  [Read more...]
The PHP BBQ tour (15.06. - 21.06.2009, Germany)
Employee +1 Vote Up -0Vote Down

It is getting summer in Germany: let’s have a PHP BBQ tour! The PHP BBQ tour is one week tour from Monday, 15.06. - Sunday, 21.06.2009 visiting the german PHP user groups. The tour will go through Munich, Frankfurt, Karlsruhe, Berlin, Dortmund, Hamburg and Kiel. The tour is an offering and a suggestion to the user group to come together for a barbecue instead of meeting in conference rooms in the middle of the summer, when the days are long. Everybody is invited to join me and other MySQLers on the tour to visit the PHP user group in his neighbor town.

Monday 15.06. Munich Tuesday 16.06. Frankfurt Wednesday 17.06. Karlsruhe Thursday 18.06. Berlin Friday 19.06. Dortmund Saturday 20.06. Hamburg Sunday 21.06. Kiel

Please check the MySQL Forge Wiki page for details:

  [Read more...]
The PHP BBQ tour (15.06. - 21.06.2009, Germany)
Employee +0 Vote Up -0Vote Down

It is getting summer in Germany: let’s have a PHP BBQ tour! The PHP BBQ tour is one week tour from Monday, 15.06. - Sunday, 21.06.2009 visiting the german PHP user groups. The tour will go through Munich, Frankfurt, Karlsruhe, Berlin, Dortmund, Hamburg and Kiel. The tour is an offering and a suggestion to the user group to come together for a barbecue instead of meeting in conference rooms in the middle of the summer, when the days are long. Everybody is invited to join me and other MySQLers on the tour to visit the PHP user group in his neighbor town.

Monday 15.06. Munich Tuesday 16.06. Frankfurt Wednesday 17.06. Karlsruhe Thursday 18.06. Berlin Friday 19.06. Dortmund Saturday 20.06. Hamburg Sunday 21.06. Kiel

Please check the MySQL Forge Wiki page for details:

  [Read more...]
PHP 5.3: Persistent Connections with ext/mysqli
Employee +0 Vote Up -0Vote Down

As of PHP 5.3 the PHP MySQL extension mysqli (ext/mysqli) supports Persistent Database Connections. Persistent Connections are new to ext/mysqli but not new to ext/mysql or PDO. The news behind the news is the usage of COM_CHANGE_USER (C-API: mysql_change_user()) by ext/mysqli - no side effects any more. The "flagship" has idiot-proof Persistent Connections.

If you do not know what Persistent Database Connections are and you speak german I would like to point you to my guest posting at

  [Read more...]
PHP 5.3: Persistent Connections with ext/mysqli
Employee +0 Vote Up -0Vote Down

As of PHP 5.3 the PHP MySQL extension mysqli (ext/mysqli) supports Persistent Database Connections. Persistent Connections are new to ext/mysqli but not new to ext/mysql or PDO. The news behind the news is the usage of COM_CHANGE_USER (C-API: mysql_change_user()) by ext/mysqli - no side effects any more. The "flagship" has idiot-proof Persistent Connections.

If you do not know what Persistent Database Connections are and you speak german I would like to point you to my guest

  [Read more...]
PHP: How mysqlnd async queries help you with sharding!
Employee +0 Vote Up -0Vote Down

Recipe for conference talks: add a buzzword like "sharding" and show how mysqlnd helps you with asynchronous queries. Only two PHP database extensions give you asynchronous queries: mysqlnd and Postgres. Slides (OpenOffice) from the International PHP Conference 2008 have the details about the asynchronous query API in ext/mysqli (using mysqlnd).

Mysqlnd Async Ipc2008

View SlideShare presentation or

  [Read more...]
PHP: How mysqlnd async queries help you with sharding!
Employee +0 Vote Up -0Vote Down

Recipe for conference talks: add a buzzword like "sharding" and show how mysqlnd helps you with asynchronous queries. Only two PHP database extensions give you asynchronous queries: mysqlnd and Postgres. Slides (OpenOffice) from the International PHP Conference 2008 have the details about the asynchronous query API in ext/mysqli (using mysqlnd).

Mysqlnd Async Ipc2008

View SlideShare

  [Read more...]
PHP: New network traffic, CPU and memory savings with mysqlnd
Employee +0 Vote Up -0Vote Down

BIT and CPU squeezing with Facebook, Tuenti and Andrey - for the die hard experts… The MySQL Client Server Protocol supports two flavours of sending database results to the client send as text and as binary. Unlike the text protocol, the binary protocol avoids converting data into strings whenever possible. For example, the binary protocol send a TINYINT column value as one byte and not as a length coded string of a length of one to four bytes. This saves CPU cycles on the server by avoiding a cast operation and it saves at least one byte of network traffic - sometimes. Furthermore, ext/mysqli will use an (PHP) integer variable instead of a string to hold the column value. This saves memory when caching database results in

  [Read more...]
PHP: New network traffic, CPU and memory savings with mysqlnd
Employee +0 Vote Up -0Vote Down

BIT and CPU squeezing with Facebook, Tuenti and Andrey - for the die hard experts… The MySQL Client Server Protocol supports two flavours of sending database results to the client send as text and as binary. Unlike the text protocol, the binary protocol avoids converting data into strings whenever possible. For example, the binary protocol send a TINYINT column value as one byte and not as a length coded string of a length of one to four bytes. This saves CPU cycles on the server by avoiding a cast operation and it saves at least one byte of network traffic - sometimes. Furthermore, ext/mysqli will use an (PHP) integer variable instead of a string to hold the column value. This saves memory when caching database results

  [Read more...]
PHP: New network traffic, CPU and memory savings with mysqlnd
Employee +0 Vote Up -0Vote Down

BIT and CPU squeezing with Facebook, Tuenti and Andrey - for the die hard experts… The MySQL Client Server Protocol supports two flavours of sending database results to the client send as text and as binary. Unlike the text protocol, the binary protocol avoids converting data into strings whenever possible. For example, the binary protocol send a TINYINT column value as one byte and not as a length coded string of a length of one to four bytes. This saves CPU cycles on the server by avoiding a cast operation and it saves at least one byte of network traffic - sometimes. Furthermore, ext/mysqli will use an (PHP) integer variable instead of a string to hold the column value. This

  [Read more...]
PDO_MYSQLND: The new features of PDO_MYSQL in PHP 5.3
Employee +0 Vote Up -0Vote Down

PDO_MYSQLND is in the PHP CVS repository at php.net: PDO_MYSQL has been patched (PHP 5.3, PHP 6.0). Try out PDO_MYSQL with the MySQL native driver for PHP (mysqlnd). Its has new features.

Since Kaj’s announcement of the MySQL native driver for PHP (mysqlnd), we promised to to patch all three PHP MySQL extensions (ext/mysql, ext/mysqli and PDO_MYSQL) optionally support it. Almost exactly a year ago, on July 27th 2007, mysqlnd and updated versions of ext/mysql and ext/mysqli have been checked into the PHP 6 (HEAD) branch of the PHP CVS repository. PDO_MYSQL was the

  [Read more...]
PDO_MYSQLND: The new features of PDO_MYSQL in PHP 5.3
Employee +0 Vote Up -0Vote Down

PDO_MYSQLND is in the PHP CVS repository at php.net: PDO_MYSQL has been patched (PHP 5.3, PHP 6.0). Try out PDO_MYSQL with the MySQL native driver for PHP (mysqlnd). Its has new features.

Since Kaj’s announcement of the MySQL native driver for PHP (mysqlnd), we promised to to patch all three PHP MySQL extensions (ext/mysql, ext/mysqli and PDO_MYSQL) optionally support it. Almost exactly a year ago, on July 27th 2007, mysqlnd and updated versions of ext/mysql and ext/mysqli have been checked into the PHP 6 (HEAD) branch of the PHP CVS repository.

  [Read more...]
PDO_MYSQLND: The new features of PDO_MYSQL in PHP 5.3
Employee +0 Vote Up -0Vote Down

PDO_MYSQLND is in the PHP CVS repository at php.net: PDO_MYSQL has been patched (PHP 5.3, PHP 6.0). Try out PDO_MYSQL with the MySQL native driver for PHP (mysqlnd). Its has new features.

Since Kaj’s announcement of the MySQL native driver for PHP (mysqlnd), we promised to to patch all three PHP MySQL extensions (ext/mysql, ext/mysqli and PDO_MYSQL) optionally support it. Almost exactly a year ago, on July 27th 2007, mysqlnd and updated versions of ext/mysql and ext/mysqli have been checked into the PHP 6 (HEAD) branch of the

  [Read more...]
PDO_MYSQLND: Monday morning murders
Employee +0 Vote Up -0Vote Down

I am a member of the monday morning murder association. I murdered bugs. As said earlier, the modification of PDO_MYSQL to support both the MySQL native driver for PHP (mysqlnd) and the MySQL Client Library (AKA libmysql) is progressing. A good number of known and unknown bugs has been killed. But some new have been found as well - an overview.

(...)
Read the rest of PDO_MYSQLND: Monday morning murders (754 words)

Showing entries 1 to 30 of 91 Next 30 Older Entries

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.