The anatomy of Twitter "8" has not been done.

Source: Internet
Author: User
Keywords HTTP anatomy overpass but
Tags apache api channel client course data design designer



"8" has not been





Beijing Xizhimen Overpass design, often people criticized. Objectively speaking, for an overpass, can extend in all directions, it is basically complete the task. The main reason for the criticisms is that the route is too complicated.





of course, from the designer's point of view, they need to take a holistic view of constraints from all sides. But considering the world's overpass everywhere, each has its own difficulties, however, such as the xizhimen overpass so confusing, it is rare. Therefore, for Xizhimen overpass designers, the difficulty is objective, but the improvement of the space is always there.





Source: (http://blog.sina.com.cn/s/blog_46d0a3930100flm9.html)-Anatomy of Twitter "8" has not been and over _ Deng kan _ Sina blog


Figure 10. Beijing Xizhimen Overpass Road


courtesy Http://farm3.static.flickr.com/2671/4113112287_86cfb1cffd_o.png





Large Web site architecture design is the same, follow the traditional design, worry and effort, but the price is the performance of the site. Web site performance is not good, the user experience is not good. The big web sites such as Twitter are able to soar, not only the design of functions to meet the needs of the Times, while technical excellence is also a necessary guarantee of success.





For example, a data transfer channel is required between mongrel and memcached. Or, strictly speaking, a client library communicating to the memcached server. The Twitter engineers first implemented a channel with Ruby. Later, a faster channel was implemented with C. Then, constantly improve the details and continuously improve the efficiency of data transmission. This series of improvements allows Twitter to run at a speed of 3.23 requests per second, from the time it was not set up, to handle 139.03 requests per second, see Figure 11. This data channel, now named Libmemcached, is open source project [38].








Figure 11. Evolving from a Ruby memcached client to a C-client with optimised hashing. These are changes increases Twitter configured from 3.23 requests/second without-caching, to 139.03 requests per second Nowadays [14].


courtesy Http://farm3.static.flickr.com/2767/4115077218_55c7250d43_o.png





Another example, the Twitter system uses message queues to deliver control signals. These control signals, from inserting queues to being deleted, have a very short life cycle. A short lifecycle means that the efficiency of the message queue's garbage collection (garbage Collection) can seriously affect the efficiency of the entire system. Therefore, improving the mechanism of garbage collection, increasing efficiency, becomes unavoidable problem,




The message queues used by
Twitter were not originally kestrel, but a simple queue tool written in Ruby. But if you continue to use the language of Ruby, there is little room for performance optimization. The advantage of Ruby is that it integrates a number of features, which greatly reduces the amount of work that is written during development. But the advantages are also shortcomings, the integration of too many functions, drag more, far-reaching, resulting in optimization difficulties.





, a Twitter engineer, joked, "Ruby resists Optimization," ("Ruby is optimization resistant", by Evan Weaver [14]). After a few attempts, the Twitter engineers eventually gave up Ruby, using the Scala language, and implemented a queue, named Kestrel [39].





's main motivation for changing languages is that Scala runs on top of the JVM, so it's a rich way to optimize garbage collection performance. Figure 12. Shows the use of Kestrel, garbage collection lag, in peacetime only 2ms, the highest not more than 4ms. Peak period, the average lag of 5ms, the highest no more than 35ms.








Figure 12. The latency of Twitter Kestrel garbage Collection [14].


courtesy Http://farm3.static.flickr.com/2617/4115072726_c611955bb2_o.png





rails gradually fade out of Twitter, which seems to be the trend. The final step, and also the most climax, may be to replace mongrel. In fact, Twitter's so-called "API Server" is probably the prelude to replacing mongrel.


"API Server" is 4 times times faster than the Apache+mongrel combination, says Twitter's Evan Weaver. The so-called Apache+mongrel combination is a way of realizing rails. The Apache+mongrel combination can handle 139 requests per second, see Figure 11, and API Server can handle approximately 550 requests per second [16]. In other words, the advantage of using a apache+mongrel combination is that it lowers the burden on engineers to write programs, but at a cost that is 4 times times less systematic, in other words, the average user waits 4 times times longer.

It's usually easy to live, and it's always hard to live well. It's a spirit.

Reference,

[] Improving running component of Twitter. (http://qconlondon.com/london-2009/file?path=/qcon-london-2009/slides/EvanWeaver_ImprovingRunningComponentsAtTwitter.pdf)


[] Updating Twitter without service disruptions. (http://gojko.net/2009/03/16/qcon-london-2009-upgrading-twitter-without-service-disruptions/)


[PDF] Open source project, Libmemcached, by Twitter. (http://tangent.org/552/libmemcached.html)


[+] Open source project, Kestrel HTC Queue, by Twitter. (Http://github.com/robey/kestrel)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.