« Hazelcast 2.0: Big Data In-Memory | Main | Stuff The Internet Says On Scalability For March 30, 2012 »

YouPorn - Targeting 200 Million Views a Day and Beyond

Update: Here's the video of the talk.

Erick Pickup, lead developer at YouPorn.com, presented their architecture in a talk titled Building a Website To Scale given at the ConFoo conference.  As you might expect, YouPorn is a beast, streaming three full DVDs of video every second, handing 300K queries every second, and generating up to 15GBs of log data per hour.

Unfortunately, all we have are the slides of the talk, so this article isn’t as technical as I might like, there’s no visibility at all on the video handling for example, but we do get some interesting details.

The most interesting takeway is that YouPorn is a pretty conventional LAMP stack, with a NoSQL twist as Redis now replaces MySQL in the live datapath. Reminds me a little of YouTube in its simplicity.

The second most interesting takeaway was the great switchover. Common wisdom says never rewrite, but in 2011 YouPorn rewrote their entire site to use PHP + Redis instead of a complex Perl + MySQL based architecture. And by all accounts the switchover went well. The site is 10% faster and they moved over 6 years of legacy data with no down time.

Read on to learn more about the YouPorn architecture...


  • Launched in 2006, acquired in 2011.
  • 100 million page views a day in 2008
  • 300K queries / sec
  • 100 Gb/s - 3 full  DVDs streamed every second
  • Logs 8GB-15GB of data per hour


  • Originally written in Perl (Catalyst application with a DBIx::Class backend)
  • Now PHP-FPM (FastCGI Process Manager)  - is an alternative PHP FastCGI
  • HAProxy
  • ActiveMQ
  • Varnish
  • Redis
  • Nginx
  • MySQL
  • Syslog-ng
  • Symfony2 - a PHP Web Development Framework.


  • The great switchover. The entire site was rewritten in 2011 to use PHP instead of a complex Perl architecture and Redis instead of MySQL and ActiveMQ.
    • Targeted 200+ million daily requests
    • Moved  6 years of legacy data without downtime
    • New site is 10% faster.
    • The process took longer than expected:
      • Had to decide on which technologies to use
      • Longer than expected learning curve
      • Moving and restructuring data from MySQL to Redis
      • Staffing
  • HAProxy - provides load balancing, intelligent load distribution, and health checks
    • Maintain two pools of servers: a write pool with a fail-over to backup-Master and a read pool will servers except the master.
  • Varnish - reverse proxy helping speed up the site and reduce server load. Used also for cache management, edge side includes (ESIs), and health check on web servers.
  • Syslog-ng - collects data on page views and is used for view counters and related videos.
  • Nginx - high performance web server running PHP-FPM and acts as a external CDNs for static files like CSS, images and JS.
  • Symfony - fast and feature rich, comes with a large set of libraries.
    • Considers Symfony2 + Redis = Rapid Development + Scalable Website - a well balanced equation.
    • Loves dependency injection.
    • Choosing a web framework doesn't mean killing performances as long as you use a solid architecture in front of it.
  • ActiveMQ - message bus designed for large sites, used for writes to MySQL and Redis.
    • They found it too rigid for a site undergoing constant changes and the gains did not justify maintaining a separate Java infrastructure.
    • Would like a do-over since the problems may have been more the developers than the tech.
  • Redis - a fast, open source, KV store, now the primary data source.
    • Updated in real-time.
    • Sorted sets are used for all lists
    • Pipelining,  executing several Redis commands with a single atomic command, is key for performance
    • After the switchover additional Redis nodes were added, not because Redis was overworked, but because the network cards couldn't keep up with Redis.
    • All reads come from Redis
    • MySQL is used to allow the building new sorted sets as requirements change.
    • Append-only-file (AOF) format is used for incremental backups and is IO pain free
    • Consider using Redis as temporary cache in front of a Redis persistent store as a way to improve performance and reduce load.
  • MySQL - in a support role to feed Redis
    • Highly normalized because it’s not used directly for the site.
    • Some tables have 100+ million rows.
    • Used to populate Redis lists with new features
  • Both GIT and SVN are used, which doesn’t work well.
  • Doctrine is used in their CMS. Great tool that has saved weeks of development.

Related Articles

Reader Comments (6)

A video of the talk should be coming soon.

I had too much to cover to go into the details. My plan was to show what was possible and cover the details in future talks/articles. I'm working on those.


April 2, 2012 | Unregistered CommenterEricPickupYP

No criticism was intended, I was just trying to explain why there may not be as many details as readers might be looking for. I know it takes a lot of work and look forward to more of the details. Thanks.

April 2, 2012 | Registered CommenterTodd Hoff

Great article, great slides. looking forward to the video..
Would be interesting to hear more details about svn/git bullet..

April 3, 2012 | Registered Commentermxx

Youporn originally developed with Perl Catalyst framework( see http://www.technewsworld.com/story/70236.html?wlc=1276880514 )
Manwin aquired youporn in apr 2010. it was already aBIG website by then.

According to presentation, their decision to change Perl Catalyst framework to PHP symphony framework is not for gaining performance but for steep learning curve for non-perl developers of new acquirer.

I seems that 10% performance gaining comes from MySQL,ActiveMQ -> Redis change. even though it seems that it's not a big improvement.

Don't blame and pretend Perl has complexity and low-performance. :)

April 3, 2012 | Unregistered Commentercamel

I'm glad the video is up.

There were 2 slight mistakes Eric called a dns-server a webserver and memcached redis at some points during the presentation.

The part I'm wondering about, how does video search work ? Is that possible with Redis ? Or do you still use MySQL text search for that ?

May 20, 2012 | Unregistered CommenterLennie

What hardware is this all running on ? Is it self hosted ?

January 30, 2018 | Unregistered Commenterzorg

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>