YouTube 系统架构

| |
[不指定 2007-12-27 18:08 | by 张宴 ]
  视频演讲:Cuong Do (YouTube/Google 的一位工程部经理)
  演讲地点:西雅图扩展性的技术研讨会

  以下为 Kyle Cordes 根据上述视频写下的文章:

  YouTube Scalability Talk

  Cuong Do of YouTube / Google recently gave a Google Tech Talk on scalability.

  I found it interesting in light of my own comments on YouTube’s 45 TB a while back.

  Here are my notes from his talk, a mix of what he said and my commentary:

  In the summer of 2006, they grew from 30 million pages per day to 100 million pages per day, in a 4 month period. (Wow! In most organizations, it takes nearly 4 months to pick out, order, install, and set up a few servers.)

  YouTube uses Apache for FastCGI serving. (I wonder if things would have been easier for them had they chosen nginx, which is apparently wonderful for FastCGI and less problematic than Lighttpd)

  YouTube is coded mostly in Python. Why? “Development speed critical”.

  They use psyco, Python -> C compiler, and also C extensions, for performance critical work.

  They use Lighttpd for serving the video itself, for a big improvement over Apache.

  Each video hosted by a “mini cluster”, which is a set of machine with the same content. This is a simple way to provide headroom (slack), so that a machine can be taken down for maintenance (or can fail) without affecting users. It also provides a form of backup.

  The most popular videos are on a CDN (Content Distribution Network) - they use external CDNs and well as Google’s CDN. Requests to their own machines are therefore tail-heavy (in the “Long Tail” sense), because the head codes to the CDN instead.

  Because of the tail-heavy load, random disks seeks are especially important (perhaps more important than caching?).

  YouTube uses simple, cheap, commodity Hardware. The more expensive the hardware, the more expensive everything else gets (support, etc.). Maintenance is mostly done with rsync, SSH, other simple, common tools.
The fun is not over: Cuong showed a recent email titled “3 days of video storage left”. There is constant work to keep up with the growth.

  Thumbnails turn out to be surprisingly hard to serve efficiently. Because there, on average, 4 thumbnails per video and many thumbnails per pages, the overall number of thumbnails per second is enormous. They use a separate group of machines to serve thumbnails, with extensive caching and OS tuning specific to this load.

  YouTube was bit by a “too many files in one dir” limit: at one point they could accept no more uploads (!!) because of this. The first fix was the usual one: split the files across many directories, and switch to another file system better suited for many small files.

  Cuong joked about “The Windows approach of scaling: restart everything”

  Lighttpd turned out to be poor for serving the thumbnails, because its main loop is a bottleneck to load files from disk; they addressed this by modifying Lighttpd to add worker threads to read from disk. This was good but still not good enough, with one thumbnail per file, because the enormous number of files was terribly slow to work with (imagine tarring up many million files).

  Their new solution for thumbnails is to use Google’s BigTable, which provides high performance for a large number of rows, fault tolerance, caching, etc. This is a nice (and rare?) example of actual synergy in an acquisition.

  YouTube uses MySQL to store metadata. Early on they hit a Linux kernel issue which prioritized the page cache higher than app data, it swapped out the app data, totally overwhelming the system. They recovered from this by removing the swap partition (while live!). This worked.

  YouTube uses Memcached.

  To scale out the database, they first used MySQL replication. Like everyone else that goes down this path, they eventually reach a point where replicating the writes to all the DBs, uses up all the capacity of the slaves. They also hit a issue with threading and replication, which they worked around with a very clever “cache primer thread” working a second or so ahead of the replication thread, prefetching the data it would need.

  As the replicate-one-DB approach faltered, they resorted to various desperate measures, such as splitting the video watching in to a separate set of replicas, intentionally allowing the non-video-serving parts of YouTube to perform badly so as to focus on serving videos.

  Their initial MySQL DB server configuration had 10 disks in a RAID10. This does not work very well, because the DB/OS can’t take advantage of the multiple disks in parallel. They moved to a set of RAID1s, appended together. In my experience, this is better, but still not great. An approach that usually works even better is to intentionally split different data on to different RAIDs: for example, a RAID for the OS / application, a RAID for the DB logs, one or more RAIDs for the DB table (uses “tablespaces” to get your #1 busiest table on separate spindles from your #2 busiest table), one or more RAID for index, etc. Big-iron Oracle installation sometimes take this approach to extremes; the same thing can be done with free DBs on free OSs also.

  In spite of all these effort, they reached a point where replication of one large DB was no longer able to keep up. Like everyone else, they figured out that the solution database partitioning in to “shards”. This spread reads and writes in to many different databases (on different servers) that are not all running each other’s writes. The result is a large performance boost, better cache locality, etc. YouTube reduced their total DB hardware by 30% in the process.

  It is important to divide users across shards by a controllable lookup mechanism, not only by a hash of the username/ID/whatever, so that you can rebalance shards incrementally.

  An interesting DMCA issue: YouTube complies with takedown requests; but sometimes the videos are cached way out on the “edge” of the network (their caches, and other people’s caches), so its hard to get a video to disappear globally right away. This sometimes angers content owners.

  Early on, YouTube leased their hardware.

  http://kylecordes.com/2007/07/12/youtube-scalability/



技术大类 » 系统架构与硬件 | 评论(51) | 引用(0) | 阅读(42335)
xujie777 Email
2012-5-18 16:32
The choices are likely to be basically countless seeing that louis vuitton outlet occurs with the help of completely new and also incredible concepts once in a while.Louis vuitton Wholesale Monogram Canvas HandbagsLouis Vuitton Collection Beach Handbags louis vuitton bags outlet Damier Canvas HandbagsLouis vuitton Mahina HandbagsLouis Vuitton Monogram Mini Lin HandbagsLouis Vuitton Monogram Multicolore HandbagsLouis vuitton Monogram Vernis HandbagsLouis Vuitton Wholesale Epi Leather HandbagsLouis Vuitton For Men HandbagsLouis Vuitton Damier Canvas WalletsLouis Vuitton Epi Leather WalletsLouis Vuitton Monogram Canvas WalletsLouis Vuitton Monogram Vernis WalleLouis Vuitton ShoesLouis Vuitton Men wallets.As the Authentic Louis Vuitton are so high-priced, so came the louis vuitton handbags outlet.
xujie777 Email
2012-5-18 16:32
coach outlet has become a popular shopping experience for consumers around the world, and a desirable distribution channel for manufacturer's and retailers.Getting your hands on coach outlet store online can be a hefty investment of hundreds of dollars.But do not despair,the Coach Outlet store could be the answer to your prayers.coach outlet online is your smart choice when you want to get the discount Coach accessory. You can find the exact Coach Bags and other accessory you want at a low price that's right for you. My dear friends, let the coach outlet online pave your way into the world of high fashion with their ultimate fashion factory.
Christian Louboutin Email Homepage
2012-5-18 17:26
christian louboutin have own characteristic designs. The beautiful crystals have added the magical finishing touch to countless bridal gowns. Just get some for yourself. The first Men's Boutique, christian louboutin uk Boutique Homme on Rue Jean-Jacques Rousseau in Paris, opened in the summer of 2012.
Louis Vuitton UK Email Homepage
2012-5-18 17:26
Cheap louis vuitton uk wholesale offers a variety of options to satisfy your needs. Some new ones even has fashionable styles fold over flap to disguise the snap closure and a draw string is added for a convenient closure. Louis vuitton outlet online just like a person who want to show himself in front of other people, because he is confident enough, he can attain the respect of other people.
CoachOutlet Email Homepage
2012-5-18 17:26
coach outlet has become a popular shopping experience for consumers around the world, and a desirable distribution channel for manufacturer's and retailers. Coach outlet online develops very quickly because it runs by its own special way and it contents the customers greatly.
Air Jordan Email Homepage
2012-5-18 17:26
Thank you for shopping in our store. We are a reliable online jordan bags seller, specialist in providing numbers of new air jordan bags at amazing price . If you need practical, fashionable and well-known nike dunks, you can consider to choosing on the nike Outlet. Its nice and popular design will make you feel a sense of fresh air.
Nike Air Max Email Homepage
2012-5-18 17:27
This nike air max for sale belongs to the sounding just what are termed as nike air vintage best sellers, many other products and services for the reason that range appearing companies the actual nike air Galliera, plus the nike air outlet monogram selection. nike dunks are made of high leather materials which can be durable and fashionable.They will make you become the focus in the streets or audience.
xujie123
2012-5-21 11:14
Our online store offers you discounted Designer louis vuitton replica wallet at present. You could find them in desirable quality and price. If you don't mind high class louis vuitton uk, have a good time here.louis vuitton Store Online Handbags can also bring great accuracy as well as practical applicability and fashionable.Have you ever dreamed of being as charming as Madonna? Have you ever thought of becoming an envy of all your friends? If so, come to louis vuitton outlet.<br/>
xujie555
2012-5-21 13:38
coach factory outlet uses graceful accessories to match the classical logo of coach, which is the best combination of coach. The handmade coach products?can make you more charming and graceful.coach factory online provides people many coach goods. If you wish to snatch the coach handbag, then this best method is made for that you like for coach discount.coach factory outlet online is a fashion brand to ensure its quality. With designer coach shoulder bags, you will always attract people's attention. The bags will emphasize your personal style and taste.<br/>
xujie333
2012-5-21 14:59
coach outlet online Store guarantee that all the coach handbags offered are own high quality. In addition , all of them are sold at an unexpected low price.If you want to purchase, just visit their website.coach factory outlet is really sizzling kinds of shopping way for you. With the usage of the replica designer coach bags, you can surely be able to change your individual looks in a stunning manner.Coach bags on sale from the coach outlet are cheap or discount prices that you certainly will stand out from the crowd on your next camping trip!<br/>
coach outlet store Email Homepage
2012-6-6 10:23
If women is the stylish carrier, then bag is  the symbol of fashion. And <strong><a href="http://www.coachoutletstoreonlinesalebag.us" target="_blank">Coach Outlet Store Online</a></strong> bag must be the representative of fashion. If you want to own one stylish enough coach bag, you should have a look at <strong><a href="http://www.coachoutletstoreonlinesalebag.us" target="_blank">Coach Outlet Store</a></strong>. All the bags in <strong><a href="http://www.coachoutletstoreonlinesalebag.us" target="_blank">coach outlet online</a></strong> are the real ones with top quality. The most important is that most of those bags are nearly 80% off. It is a good opportunity for coach bags lovers. Come on.
coach outlet store Email Homepage
2012-6-6 10:23
If women is the stylish carrier, then bag is  the symbol of fashion. And Coach Outlet Store Online bag must be the representative of fashion. If you want to own one stylish enough coach bag, you should have a look at Coach Outlet Store. All the bags in coach outlet online are the real ones with top quality. The most important is that most of those bags are nearly 80% off. It is a good opportunity for coach bags lovers. Come on.
cheap oakley sunglasses Email Homepage
2012-7-7 09:52
The oakley sunglasses  online shop is really a wonderful and useful. It sells all-round discount oakley sunglasses include to sunglasses which obstruct the rays, light color sunglasses and special-use sunglasses. The ordinary oakley sunglasses is usually used to reduce the glare. The light color sunglaesses is used to decoration . The Oakley Active Sunglasses is usuallly used by the climber or other people who like to do sports. In the Discount oakley sunglasses you can buy whatever you need, to choose Discount oakley sunglasses is right.A great many people in the world like to purchase  oakley sunglasses from cheap oakley sunglasses.It is necessary for the everyone to buy a pair of oakley sunglasses in the hot summer. To wear the sunglasses is not only used to obstruct the uv but also to make you look much more charming. Please place an order now.
chanel outlet Email Homepage
2012-8-7 17:40
coach88888888 Email
2012-8-13 17:44
If you desire to go to Coach Factory Outlet, but have no idea in which to go, you can research online. It is no doubt that there is drastically information and details about it for the reference.Coach Factory Online are loved by many people, when you walk in the street, you could see many people take coach styles.hat experts claim Coach Outlet Online shopping is in the changes they are available in.Coach Outlet will send you a coupon in the post to use in their upon only after you type a achieve. The Coach bags are customarily somewhat many than the ones in the stores.
chanel bags outelt online Email Homepage
2012-9-4 11:10
GFHG Email Homepage
2012-9-26 11:01
What their skincare does provide is Karen Millen dress typically a complete variety of moisturizing options such as lotions, gels, serums and milk in add-on to cleansers and skin tone whitening products.The components consist of a facial bar dish and also a bowl equally of that are gorgeous decorative merchandise that occur to be also useful.One with the most famous manufacturers with worldwide recognition, their products and Karen Millen solutions are also in favor with celebrities and her clientele consists of the likes of Christina Ricci, Cher, Gwen Stefani and Drew Barrymore.Despite predominantly becoming a style and clothing brand, Anna Sui skin tone treatment is between the best 5 greatest marketing manufacturers in Asia according to some guide by Susan Muaddi Darraj released in 2009.Despite becoming an Asian American herself, Anna Sui skincare products and solutions are appropriate for everybody and so are typically granted a individual touch through the Karen Millen Ireland extremely productive artist herself.Floral motifs (especially roses) are typical during the packaging and bottle or container design.
Clarisonic Outlet Email Homepage
2012-11-17 10:31
Now many people know this topic. Very attractive. So I came to a published personal opinion, only a person point of view. Again, I recommend you use this station.
Gucci Outlet Email Homepage
2012-11-17 10:34
Very meaningful an article, I've been looking for a long time about this article. Finally see yes. This is an article I see good. Share it. Is worth to recommend.
Mulberry Sale Email Homepage
2012-11-17 10:36
I think I come here to see is right, this theme or need to know. There are a lot of attractive. I will often come to. I hope I can see you. Meeting people.
分页: 2/3 第一页 上页 1 2 3 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]