The biggest challenges of today's web development are performance, scalabilty, rapid development and maintainability of the source code. Usually one quickly sets on abstraction models such as MVC, which poor covers the above mentioned requirements for today's development. Since my main concern is scalable and secure code, I've developed my own model, which solves the needs better. Below I will explain the model and take reference to my SQL class that implements this model.
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. So what does this mean for Drupal?
An opcode cache is used to keep compiled PHP code in memory. In a nutshell, when there's a request for a Drupal node, there are all kinds of PHP code that need to be compiled before PHP can execute that code to query the database, create the webpage, and send it to the browser. The more complex your Drupal site, IE the more modules you have installed, the more PHP code that needs to be compiled. This compilation process occurs on every request to your Drupal site. By installing and enabling an opcode cache, your server will compile all the PHP code once, then store it in memory for later use. When a request happens again for the same PHP code, the opcode …
[Read more]The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. So what does this mean for Drupal?
An opcode cache is used to keep compiled PHP code in memory. In a nutshell, when there's a request for a Drupal node, there are all kinds of PHP code that need to be compiled before PHP can execute that code to query the database, create the webpage, and send it to the browser. The more complex your Drupal site, IE the more modules you have installed, the more PHP code that needs to be compiled. This compilation process occurs on every request to your Drupal site. By installing and enabling an opcode cache, your server will compile all the PHP code once, then store it in memory for later use. When a request happens again for the same PHP code, the opcode …
[Read more]I think most developers are able to cache database queries by now. But what about DML queries? Every query, connection - or in the general case - ressource needs time. So I thought a lot about how to write data as efficiently as possible into the database - in my case MySQL. Hmm...We have to take a closer look at the details and we can't choose the same asynchronously writing method for every kind of query. With kind of query I mean that it depends on what storage engine we use, the complexity of the query, should more than one record be written at once, are triggers involved and so on. Sure, the one or the other query MUST be written instantly, but most of the writing querys are stackable with no need to check if the request has succeed.
Most of this stuff is not PHP specific, and Python or Ruby or Java or .NET developers can use the tools in this talk.
The session on joind.in, with user comments/feedback, is at http://joind.in/talk/view/1320.
Slides are at http://talks.php.net/show/confoo10
“My name is Rasmus, I’ve been around for a long time. I’ve been doing this web stuff since 1992/1993.”
“Generally performance is not a PHP problem.” Webservers not config’d, no expire headers on images, no favicon.
Tools: Firefox/Firebug extension called YSlow
(developed by yahoo) gives you a grade on your site.
Google has
developed the …
So, when you connect on the fly to a database your subject to a
variety of issues, like when the db is not available and when the
db does not have a route.
One of the main reasons why a dev may want to connect on the fly
is because they have too many front ends to hold a persistent
connection on the backends. Since mySQL does not use libevent,
holding open threads to mySQL is much more costly. Threads ==
Memory.
But, that's here nor there. The main purpose of this post is to
talk about how to recover from failed connections that block
apache threads.
Common Failures:
No route to Host
Flapping NIC
Locked Tables
Recovering from a Crash
more of the same.
My Environment:
I have a bunch of webservers (200+) that all have 300 possible
threads (60000 possible connections to a single DB) behind a load
balancer that uses the LB least connections …
Many folks have reported problems with APC in
Cool Stack 1.1 resulting in a SEGV in the CoolTools Forums.
The APC version in Cool Stack 1.1 is APC 3.0.11 and if enabled,
extensions such as mysql, dtrace etc. fail with a SEGV. Media Wiki doesn't
work either.
We have tested APC 3.0.14 and this version seems to work much better and I'm keeping my fingers crossed that it will work for you as well. Our performance testing doesn't show any substantial differences between 3.0.11 and 3.0.14. If you want to give it a try, simply download the correct file for your platform and rename it to apc.so in your php extensions directory …
[Read more]
Many folks have reported problems with APC in
Cool Stack 1.1 resulting in a SEGV in the CoolTools Forums.
The APC version in Cool Stack 1.1 is APC 3.0.11 and if enabled,
extensions such as mysql, dtrace etc. fail with a SEGV. Media Wiki doesn't
work either.
We have tested APC 3.0.14 and this version seems to work much better and I'm keeping my fingers crossed that it will work for you as well. Our performance testing doesn't show any substantial differences between 3.0.11 and 3.0.14. If you want to give it a try, simply download the correct file for your platform and rename it to apc.so in your php extensions directory …
[Read more]
Many folks have reported problems with APC in
Cool Stack 1.1 resulting in a SEGV in the CoolTools Forums.
The APC version in Cool Stack 1.1 is APC 3.0.11 and if enabled,
extensions such as mysql, dtrace etc. fail with a SEGV. Media Wiki doesn't
work either.
We have tested APC 3.0.14 and this version seems to work much better and I'm keeping my fingers crossed that it will work for you as well. Our performance testing doesn't show any substantial differences between 3.0.11 and 3.0.14. If you want to give it a try, simply download the correct file for your platform and rename it to apc.so in your php extensions directory …
[Read more]