How Flickr uses PHP, MySQL and Web Services
Submitted by kai on Thu, 2006-03-09 21:45. ::
Moshe Weitzman posted a link to this great presentation “Flickr and PHP” by Cal Henderson in the developer mailing list of Drupal. It's about how Flickr uses PHP, MySQL and Web Services. I found another very similar presentation.
Here's a different one done by Cal at O'Reilly Emerging Technology Conference: Web Services Mash - up
Here is what I took away from these presentations:
- Scale database access horizontally to handle database update/insert/delete and select separately
- Serve static data from a standalone server.
- Replicate searchable data in MySQL ISAM tables just for searching.
- Don’t try to normalize tables blindly because joins are expensive
- Shared nothing, everything is in DB, even template caches
- Web Service API is stateless
- Safeguard against misuse of APIs
- Be open. Let others have a chance to manipulate your data through APIs. People are creative. It's free labor when you get people write apps based on your APIs.
I have some questions though:
- What is the node service really in Flickr’s logical architecture? It seems like an XML-protocol layer to access DB.
- What kind of web servers (Apache? Lighttpd, thread-based? Process-based?), and how many of them are used? Is any kind of PHP cache optimizer used?
- He claimed normalization is bad for performance. The following setup came across my mind: the master DB can have all the normalized tables/data, and de-normalized data/tables are constructed in the slave DB. I think whether this works or not depends on how replication works in MySQL. I assume it's fastest to replicate data when the DB structure is the same.
Tags: php mysql flickr scalability











