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

Luciano Mammino:
6 Rules of thumb to build blazing fast web server applications
Jul 28, 2015 @ 14:48:33

Luciano Mammino has posted six tips for blazing fast web applications to his site. These tips aren't as much specific to the code (though they're related) as they are general good practices around architecture, development work and common issues.

In this post I will try to highlight some of the most common principles that you have to take under consideration when you want to achieve a great level of performance while building a web application (specifically on the backend part). I believe the concepts discussed here can be applied to any language and framework even if, due to my specific experience, I will mention some examples, design patterns, conventions and tools that are mostly used in the PHP world.

His post lists out six main rules along with some description and links to other tools for each:

  • Avoid premature optimization
  • Do the minimum amount of work to solve the problem
  • Defer the work you don't need to do immediately
  • Use cache when you can
  • Understand and avoid the N+1 query problem with relational databases
  • Prepare your app for horizontal scalability when possible

There's lots of good tools mentioned here so find one that fits your needs and helps solve the issue. There's also some good articles mentioned, giving more information about a particular topic or other perspectives on how to solve it a different way.

tagged: tips rulesofthumb fast web application optimize work cache nplusone scale horizontal

Link: http://loige.co/6-rules-of-thumb-to-build-blazing-fast-web-applications

DigitalOcean Community Blog:
Horizontally Scaling PHP Applications: A Practical Overview
Apr 24, 2015 @ 18:06:49

On the Digital Ocean blog there's a new post with a "practical overview" of how to effectively scale PHP applications, specifically as it relates to horizontal scaling not vertical.

Shipping a website or application to production has its own challenges, but when it gets the right traction, it’s a great accomplishment. It always feels good to see the visitor numbers going up, doesn’t it? Except, of course, when your traffic increases so much that it crashes your little LAMP stack. [...] But fear not! There are ways to make your PHP application much more reliable and consistent. If the term scalability crossed your mind, you've got the right idea.

The article starts with a brief overview of what scalability is and the main difference between horizontal and vertical scaling (scaling out vs scaling up). They then get into a bit more detail about what horizontal scaling is and how it commonly works in relation to the average PHP application (complete with diagrams). They also talk about some things you can do inside your code to help make things flow a bit more smoothly including decoupling between services and user session/file consistency measures. There's also a bit at the end about load balancing but as that depends a good bit on what technology you're using and the actual load, they just provide an overview and some links to other articles and tutorials with more information.

tagged: scaling application horizontal vertical decouple consistency loadbalance

Link: https://www.digitalocean.com/company/blog/horizontally-scaling-php-applications/

Ryan Gantt's Blog:
Horizontal reusability with traits in PHP 5.4
Aug 24, 2011 @ 15:42:42

Ryan Gantt has a new tutorial posted to his blog today looking at one of the features in the upcoming PHP 5.4.x releases - traits. Specifically he looks at the horizontal reusabillity they allow for in your applications.

The ability for a class to inherit from multiple parents is maligned by many, but can be a good thing in some situations. For those working in PHP, multiple inheritance has never been an option; classes are limited to one parent, though they can implement many other datatypes through the use of interfaces. Interfaces can lead to code duplication in improperly-factored inheritance hierarchies. Even in well-architected hierarchies, multiple classes that implement similar methods can contain a lot of overlap.

He starts with a definition of what traits are and where their real usefulness is (as well as what should be the difference between a class and a trait). He gives an example of a typical hierarchy where two classes extend a parent but then they both need the same functionality. Code duplication's not a possibility and inheritance make run into exposure issues. Traits come to the rescue by dropping in just the feature you need when you need it. His example code shows adding some logging to a simple class via a "Logging" trait and a "Singleton trait" example.

tagged: horizontal reusability traits singleton logging tutorial introduction

Link:

Lukas Smith's Blog:
Horizontal Reuse aka Traits Reloaded
Mar 26, 2010 @ 15:38:14

In a quick post to his blog Lukas Smith talks about the proposal for traits support that's been pending for PHP for a while now. Recent updates have been made to it, so it's come back up to the front of developer's minds:

Stefan has since tweaked the proposal and in the latest version it includes an alternative approach called Grafts along with the original Traits idea, which is essentially language level delegation pattern support. I am absolutely sure that we will either see Traits or Grafts in the next non patch release of PHP (aka 5.4 or 6.0).

Lukas would like to see the support go in sooner than later, so he requests some comments and thoughts on the proposed functionality and to leave them as comments on his blog entry.

tagged: horizontal reuse traits rfc grafts

Link:

Marco Tabini's Blog:
5 PHP Performance Tips You Probably Don't Want To Hear
Dec 12, 2006 @ 19:07:38

In a new entry on his blog today, Marco Tabini introduces us to 5 PHP Performance Tips that we "probably don't want to hear".

I thought it might be interesting to write an article about the performance-enhancing tips you probably don't want to hear about - that is, those that are most likely to produce measurable (and durable) results but do require some effort on your part.

His list consists of:

  • You Don't Need To Plan Ahead In Order To Have A Plan
  • Combat Database Abuse
  • Do You Really Need A Database Anyway?
  • Scale Horizontally
  • Refactor To Scale Vertically
For each, he explains the title and gives a bit of validation to the point. There's some great mentions of tools that you can use to help accomplish them too - a profiler, the Lucene and Xapian full-text databases, and Lustre.

tagged: performance tip plan database abuse scale horizontal vertical performance tip plan database abuse scale horizontal vertical

Link:

Marco Tabini's Blog:
5 PHP Performance Tips You Probably Don't Want To Hear
Dec 12, 2006 @ 19:07:38

In a new entry on his blog today, Marco Tabini introduces us to 5 PHP Performance Tips that we "probably don't want to hear".

I thought it might be interesting to write an article about the performance-enhancing tips you probably don't want to hear about - that is, those that are most likely to produce measurable (and durable) results but do require some effort on your part.

His list consists of:

  • You Don't Need To Plan Ahead In Order To Have A Plan
  • Combat Database Abuse
  • Do You Really Need A Database Anyway?
  • Scale Horizontally
  • Refactor To Scale Vertically
For each, he explains the title and gives a bit of validation to the point. There's some great mentions of tools that you can use to help accomplish them too - a profiler, the Lucene and Xapian full-text databases, and Lustre.

tagged: performance tip plan database abuse scale horizontal vertical performance tip plan database abuse scale horizontal vertical

Link:


Trending Topics: