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) | 阅读(38863)
vivid
2008-3-8 20:22
Hey pal, do you have the download link of this video? Thanks:)
EVB
2008-6-12 07:39
uplook
www.youtubebbs.tk Homepage
2010-9-17 00:16
看不懂,懒得看了
coach outlet store online Email Homepage
2012-3-8 15:46
Vehicles will not be low priced, they can be very affordable. Select essential for anyone to featuring retail outlets nowadays to get the best tote with Coach Outlet bags. You're able to look online and also pick up many of the most well liked, most recent and design seems to be however , less expensive costs added to reliable Coach Outlet Online carriers you will find anywhere! A good actions immediately and select a very good and stylish for you to share personal persona?    
     To find out more take a look at our site, with a little luck you want you can savor the shopping. Your product or service also can be learned throughout critical high-end merchants just like. presently involve some connected with kinds of layouts, duffel, Coach Outlet Store totes are generally considered as a result of exclusivity as well as know how that may come to be for you to work for any type of expanded phase of time. Dullard's and a lot of additional trainer wall socket store. What type of handbags you decide on are usually a person. Keep in mind that a person's purse is reflecting the identity and design, but you should definitely really do the Somebody you ought to develop into. It does not matter Coach Online Outlet Store sacks that is, in the event you Purchased it, it is possible to stroll all-around with all your travel retained large. Eventually, really don't disregard to not ever expend an excessive amount. If you wish this name brand, understand on the web less expensive. For those who will have to waste money make sure don't use a credit-based card.
Alinacarol Email Homepage
2012-5-5 15:42
Discount Oakley Sunglasses are recognized as getting some of the best decree eyes in the world. With our abounding account lab, we can accompany the world’s best Cheap Oakley Sunglasses to a bounded market with the Internet we can accompany Oakley Sunglasses to anyone in the UK. Oakley Sunglasses Outlet are offered in a ambit of colors, animosity options and achievement coatings.It is our honor to introduce you Oakley Sunglasses Cheap. They are Newest Oakley Sunglasses online. According to the sale status, Customers like Oakley Sunglasses Discount.Oakley Men's Radar Blue Iridium Sunglasses Sliver Frame is cool and outstanding in Oakley wholesale here popular.Oakley Sunglasses Discount can make you charming in everywhere .Welcome to visit.
Alinacarol Email Homepage
2012-5-5 15:43
Discount Oakley Sunglasses are recognized as getting some of the best decree eyes in the world. With our abounding account lab, we can accompany the world’s best Cheap Oakley Sunglasses to a bounded market with the Internet we can accompany Oakley Sunglasses to anyone in the UK. Oakley Sunglasses Outlet are offered in a ambit of colors, animosity options and achievement coatings. It is our honor to introduce you Oakley Sunglasses Cheap. They are Newest Oakley Sunglasses online. According to the sale status, Customers like Oakley Sunglasses Discount.Oakley Men's Radar Blue Iridium Sunglasses Sliver Frame is cool and outstanding in Oakley wholesale here popular. Oakley Sunglasses Discount can make you charming in everywhere .Welcome to visit.
Alinacarol Email Homepage
2012-5-5 15:45
Oakley Sunglasses Discount offers excellent performance and fashionable shape for Oakley lovers. The lens from  Oakley Sunglasses Discount is smudge resistant and easy to keep clean. They will take a active on preventing the rain and glare.  Oakley Sunglasses Cheap is obsessed with comfort. The lightweight O-Matter frame with three-point fit featured guaranteed the lenses precise optical alignment. Exclusive ear socks and nose pads also do a great performance in enhancing the comfort. Oakley Sunglasses Outlet  arrives with slightly vintage rectangular glasses. Lightweight lens designed and delicate vintage frame designed elevate the aesthetics of this Oakley Sunglasses.
Coach Outlet Store Email Homepage
2012-5-8 08:49
Famous Coach Outlet Store Online are one of the best handbags series in the market for females nowadays. The Coach Outlet Store series do make ladies become more charming and outstanding if they choose the most suitable one, which could be used in a variety of occasions. Coach Handbags Outlet female will be the actuality the fact Coach Online Sale that long-term history of Coach Outlet Online. No just one could deny the big accomplishment that Coach Bags Outlet< made all through our existence Coach outlet onlineand will operate Coach Outlet Online Store accomplishment toward future.
coach factory outlet Email Homepage
2012-5-17 11:17
Today, following half a century, mentor leather-bases coach factory outlet continues to be the delicate craft of leather-based master is accountable for,Would you like to meet more friends, or go with the times? If yes, coach factory online is opening welcome doors to you.in the market you definitely can find various colorways that are designed in as well as the high quality that applied in. For most of you would like to come. So just come to our coach factory outlet online store to choose one.
louis vuitton sale Email Homepage
2012-5-17 11:17
Louis Vuitton belt at louis vuitton sale is one kind of fashion accessory with high cost performance among the Louis Vuitton accessories.Offering quality LV products with favorable prices, louis vuitton outlet store is at your service. Hurry up, or you can not seize the chance.in fact, louis vuitton is one of the most famous fashion design master.he opened the fist suitcase shop called after his name.
coach outlet online Email Homepage
2012-5-17 11:18
I heard of coach outlet online through the advertisement when I was shopping. And now I often brow the webpage and buy Coach bags online.It is a symbol regarding position not to mention nature.Here I would like to launch a excellent bags pertaining to business men.Which may be coach outlet store.coach outlet has always been simple,durable style features to win consumers.The products are more flexible,with easy bleaching,wear characteristics,and simply use a damp cloth.
coach outlet, Email Homepage
2012-5-17 11:18
Remember the coach outlet provide coach bags which won't be deteriorated into its overall styles by any means. It will maintain its looks, colors, and uniqueness for long time.coach outlet store online has been voted by Hour Detroit magazine readers as the Best of Detroit in their 12th annual readers'poll.Lots of women like which usually amount normally include a coach outlet online ,it provides coziness to many girls that don't even think it is a great bushel of great interest directly to them.
Coach Outlet Online Email Homepage
2012-5-18 10:16
to obtain Coach Outlet Online in Hainan is amongst the brand new darling from residential holiday makers.He has served as Chairman and Chief Executive Officer of Coach since November 1995. He has served as a member of Coach Outlet Board of Directors since June 1, 2000, the date of incorporation. 
Coach  Outlet Email Homepage
2012-5-18 10:39
Coach Outlet was founded in 1941, in a loft in New York City.as a partnership called the Gail Manufacturing Company. Gail Manufacturing Company began as a family-owned business, with six leatherworkers who made small leather goods, such as wallets and handbags.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  Outlet Email Homepage
2012-5-18 10:45
Five years later in 1985, the Cahns decided to sell Coach Outlet after determining that none of their three children had any desire to take over the family leatherware business . Coach was then sold to Sara Lee Corporation for $30 million dollars.electric, diesel and mainline electric multiple units (EMU, DMU, MEMU), metro Coach Outlet Canada and Diesel Electric Tower Cars (DETC), Accident Relief Medical Vans (ARMV), Inspection Cars (RA), Fuel Test Cars, Track Recording Cars, the latest coaches are for the Deccan Odyssey . 
Louis Vuitton Email Homepage
2012-5-18 10:51
During this period, Louis Vuitton incorporated its leather into most of its products, ranging from small purses and wallets to larger pieces of luggage.To emphasize Jacobs's fashionable volte face, Kate Moss-last season's saucy Louis Vuitton UK dominatrix was recast for spring as the ballerina on that music box in a gleaming white baby doll frock and Barbie white stilettos. 
Louis Vuitton UK Email Homepage
2012-5-18 10:57
This Louis Vuitton UK for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.In 1983, the company joined with America's Cup to form the Louis Vuitton Cup, a preliminary competition (known as an eliminatory regatta) for the yacht race. 
xujie777 Email
2012-5-18 16:31
We aim to make all our customers satisfy with our products. You will find a variety of Men's fashion louis vuitton uk, fashion Women's cheap Louis Vuitton bags in our store at affordable price.Thinking of interesting ways to cost a milestone birthday? louis vuitton online shop had one of the most distinctive distinctive celebrations.bakery along with living room operated by means of about three moment louis vuitton online Most effective Pastry Chef’s of the year Rammy Nominee Chef’s.
分页: 1/3 第一页 1 2 3 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]