Live data from Hacker News

Scaling PHP Book: I will teach you to scale PHP to millions of users

scalingphpbook.com

31–40 of 105 posts

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#31
post #4

What is the expected price point of the book? Since you're in the middle of writing, do you have any opportunities for "beta" testers who can provide feedback in exchange for complementary copies?

Probably $39.99, similar to bootstrappingdesign. Shoot me an email using the contact form on my website and we can coordinate some kind of beta testing once I push it to leanpub.

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#32
post #8

Good to know other people want to share about successful scaling with PHP. On the downside, I have a book cooking on the same exact subject, with release planned September (self-publish, about 80% done), but now not sure if it's worth continuing. [edit]Slight moment of "panic", as seeing someone else releasing a book on the same subject made me sad, but you're right, no reason not to continue.

At my first company, I freaked when we got a major competitor. The CEO smiled and said it was the first sign of a good market. He was concerned about the lack of competition up to that point.

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#34
Good timing on the pre-release promotion. Now keep us updated in a weekly basic and you will sell a lot of copies here.

I'm glad you are writing the book. It seems like a worthy addition to my bookshelf. Will you be blogging about specifics mentioned in the book?

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#35
post #33

Nice to see someone who actually created a large volume site discuss their learnings vs. theoretical works discussing how stuff (c|s)hould be done without real experience. Would love to see a chapter list!

+1 for a chapter list (even a rough one)

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#36
post #33

Nice to see someone who actually created a large volume site discuss their learnings vs. theoretical works discussing how stuff (c|s)hould be done without real experience. Would love to see a chapter list!

I'll have one posted in the next day or two.

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#37

I have a pretty comprehensive list of chapters, but I'm still adding content to the book, so if you guys have any ideas or suggestions for topics you'd like to see covered, feel free to email me or post them here. Thanks so much!

I'm very interested what differences microptimizations (like using while(list() = each()) instead of foreach) make when scaling. Also, I noticed that when I clicked the return to website after clicking on the subscribe button your website, it went to google.com instead, and when I clicked continue to our website button after clicking the email confirmation link, it went to http://www.phpscalingbook.com/ (404 error).…

On a typical LAMP web site the hottest bottlenecks are usually PHP is waiting for database I/O, it's not typical that slight code optimizations will produce a dramatic improvement.

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#38
Here's a short list:

1. Cache the output at the edges: Use Varnish or other reverse proxy cache.

2. Cache byte code: Use APC or XCache PHP opcode cache.

3. Cache and minimize database I/O: reduce database touches using memcached, redis, file caches, and application-level caches (ie. global vars)

4. Do event logging in local files, not to the database: Make all write operations as simple and fast as possible, any data that is not needed in realtime can be written to a plain old file and processed later.

5. Use a CDN, especially for delivering static assets

6. Server tuning: Apache, MySQL, and Linux have lots of settings that affect performance, especially the timeout settings ought to be turned down.

7. Identify bottlenecks: At the system level use tools such strace, top, iostat, vmstat, and query logging to see which layer is using the most time and resources. Also there's an excellent PHP code profiling service called New Relic that drops you right into the function and db query that's eating up most of the time in slow requests.

8. Load testing: DoS yourself. Stress test your stack to find bottlenecks and tune them out

9. Remove unused modules: For each component in the stack unload any default modules that are not needed to deliver your service.

10. Don't use ORMs and other dummy abstractions: Take off the training wheels and write your own queries.

11. Make the entry pages fast, simple, and cacheable. Nobody is reading that silly news feed in bottom corner of your front page and it's killing your database, so take it out.

Most of the time a PHP slows down because each PHP process is blocked waiting for I/O from some other layer, either a slow disk, or overloaded database, or hung memcached process, or slow REST API call to a 3rd party service ... often just strace'ing a live PHP process will show you what its waiting for ... in short, blocking I/O slows down everything. The key to going faster is:

* keep it simple

* cache as much as possible in local memory

* do as few blocking I/O operations as possible per request

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#39
post #4

What is the expected price point of the book? Since you're in the middle of writing, do you have any opportunities for "beta" testers who can provide feedback in exchange for complementary copies?

Probably $39.99, similar to bootstrappingdesign. Shoot me an email using the contact form on my website and we can coordinate some kind of beta testing once I push it to leanpub.

Will do - I see the subscribe link, but no contact info, just twitter. I've signed up for the list.

Re: Scaling PHP Book: I will teach you to scale PHP to millions of users

#40
post #38

Here's a short list: 1. Cache the output at the edges: Use Varnish or other reverse proxy cache. 2. Cache byte code: Use APC or XCache PHP opcode cache. 3. Cache and minimize database I/O: reduce database touches using memcached, redis, file caches, and application-level caches (ie. global vars) 4. Do event logging in local files, not to the database: Make all write operations as simple and fast as possible, any data…

Could you post this on StackOverflow or would you allow me to? It's very useful, way more people could benefit from this!
Post reply on HN