Showing entries 91 to 100 of 205
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: PlanetPHP (english) (reset)
PHP/C: Does MYSQL[I]_OPT_CONNECT_TIMEOUT work?

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: the mysqlnd slow query log (incl. backtrace)

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 5.1.21+)
  • SQL statement …
[Read more]
PHP: the mysqlnd slow query log (incl. backtrace)

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 5.1.21+)
  • SQL statement …
[Read more]
PHP: 150 performance tuning screws for mysqlnd

Yes, 150 means we added some 30 performance statistics to the MySQL native driver for PHP (mysqlnd) since monday. The new statistics are explained in three words: counting COM_* commands. COM_* commands refers to the command packets of the MySQL client server protocol. For example, COM_QUERY is used to execute nonprepared SQL statements.

Please check the earlier blog postings on how to use and access the statistics: PHP: 59 tuning screws for mysqlnd, PHP: 120 tuning screws for mysqlnd. The information given in those articles will find its way into the PHP and MySQL manual. The MySQL documentation team is working on an …

[Read more]
PHP: 150 performance tuning screws for mysqlnd

Yes, 150 means we added some 30 performance statistics to the MySQL native driver for PHP (mysqlnd) since monday. The new statistics are explained in three words: counting COM_* commands. COM_* commands refers to the command packets of the MySQL client server protocol. For example, COM_QUERY is used to execute nonprepared SQL statements.

Please check the earlier blog postings on how to use and access the statistics: PHP: 59 tuning screws for mysqlnd, PHP: 120 tuning screws for mysqlnd. The information given in those articles will find its way into the PHP and MySQL manual. The MySQL documentation team is working on an …

[Read more]
PHP: 120 tuning screws for mysqlnd

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 corresponding …

[Read more]
PHP: 120 tuning screws for mysqlnd

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 corresponding …

[Read more]
The big POINTS in life

How large can a column of the data type POINT be: 10 bytes, 100 bytes, 1k, 10k? No… think Enterprise! PHP will allocate 4GB of RAM if you use the Prepared Statements of ext/mysqli and the MySQL Client Library (AKA libmysql) to fetch a POINT column. Of course, the MySQL native driver for PHP (mysqlnd) does better!

To understand why ext/mysqli can allocate up to 4 GB of RAM to fetch a POINT column we need to have a look at the MySQL C API. PHP itself is written in C and in a way ext/mysqli is just a plain vanilla C API client application. The C API is provided by the MySQL Client Library which has been called "libmysql" in the past. The MySQL Client Library implements the MySQL Client Server Protocol. The MySQL native driver for PHP (mysqlnd) is an alternative implementation of the MySQL Client Server Protocol and it is part of PHP source code as of PHP 5.3. If that is a new to you, please have a look …

[Read more]
The big POINTS in life

How large can a column of the data type POINT be: 10 bytes, 100 bytes, 1k, 10k? No… think Enterprise! PHP will allocate 4GB of RAM if you use the Prepared Statements of ext/mysqli and the MySQL Client Library (AKA libmysql) to fetch a POINT column. Of course, the MySQL native driver for PHP (mysqlnd) does better!

To understand why ext/mysqli can allocate up to 4 GB of RAM to fetch a POINT column we need to have a look at the MySQL C API. PHP itself is written in C and in a way ext/mysqli is just a plain vanilla C API client application. The C API is provided by the MySQL Client Library which has been called "libmysql" in the past. The MySQL Client Library implements the MySQL Client Server Protocol. The MySQL native driver for PHP (mysqlnd) is an alternative implementation of the MySQL Client Server Protocol and it is part of PHP source code as of PHP 5.3. If that is a new to you, please have a look …

[Read more]
PHP BBQ Tour 2009

The PHP BBQ tour 2009 is over. Some 145 people came to 7 meetings held in 7 different citties in Germany. The basic idea of having a series of barbecues, shortly before midsummer, to get together and having fun at a very relaxed atmosphere has worked out well.

People got connected. Some attendees came to the PHP user group meetings, who have never been seen at a regular meeting before. Some even travelled 1.5 hours per way to get to the events. Members of the user group Köln/Bonn took the opportunity to visit their friends in Dortmund and members of the user group Stuttgart have travelled to Karlsruhe for the first time.

People had fun. Look at the faces of those who came to the events, check out the photos. Due to bad weather conditions and rain showers there have been only two true BBQs. However, the BBQ …

[Read more]
Showing entries 91 to 100 of 205
« 10 Newer Entries | 10 Older Entries »