Distributed programming with Ruby Reading notes seven Starling and AMQP/RABBITMQ (Part3 chapter7-8)

Source: Internet
Author: User
Tags rabbitmq

Part III distributed Message Queues Part III breaks from this ' traditional ' approach of distributed computing and look s at distributed message queues.
  • Chapter7 Starling:
    • including 9 parts:
      • What is a distributed Message Queue?
      • Installation
      • Getting Started with Starling
      • "Hello World" the Starling
      • Building a distributed Logger with Starling
      • Persisted Queues
      • Getting Starling states
      • Conclusion
      • Endnotes
    • "Starling is a powerful, but simple messaging server, enables reliable distributed queuing with an absolutely minimal o Verhead. "
    • It talks a lot about what a distributed message queue was, how to use it, and lets your on some of the mistakes Twitter m Ade So, you don ' t make them yourself.
    • What is a distributed Message Queue?
      • You send a message to the "queue that" at some point on the future would be picked up by a remote system (processor) and would Then being acted on. If There is no messages, the processor keeps checking until it finds a message to act on. When a message is found, the processor rocesses it, and the cycle starts again.
      • picture Twitter's application, if you can. Twitter has lots of people tweeting simultaneously. When a tweets comes in, it must is processed. When it was processed, the followers of the tweeters need to be notified of the new tweet. These notifications can range from emails to text messages to updating the Tweeters page. If someone has a large number of followers, it can take several moments to generate and send those notifications. If Twitter were to try and does this in real time as new tweets arrived, then no new tweets would is able to get into the SY Stem because the servers would be too busy processing previous tweets. The system would fall down under the weight of it all. Enter the distributed message queue.
      • By using a distributed message queue, the Twitter can process each tweet offline instead of the when are submitted. This means if tweets come in, the requests can be handled quickly. Later a processing server can come along, pick the tweets off the queue, and process them. This makes to a much more responsive and scalable system.
    • Installation
      • Command line: Gem install Starling
    • Getting Started with Starling
      • Starling is an interesting library. Instead of building everything from scratch, Blaine Cook and Company decided to "speak" Memcached.
      • Command: Starling--help
      • Start: sudo starling
        • Windows directly starling. Try it, maybe.
        • If you want to daemonize and create a complex server Setup, I recommend using the Config setting and creating a YAML3 file To store these settings to make it easy to start/restart your server. Page149 have a little bit of how to configure the explanation, will not stick over.
      • Example:with Our servers now running:
      • Still unable to run successfully, should be lack of memcached? I don't know... No mood.
      • Page152 mentions the Starling.flush method
    • "Hello World" the Starling
    • Example: Page155 browsing, very concise, basically is set get
    • Building a distributed Logger with Starling
    • Example in Page157
    • Persisted Queues
      • As mentioned earlier, Starling uses the Memcached protocol, which might beg the question, "Why isn't just use Memcached?" That ' s a great question. The answer is your could use Memcached instead of Starling, and you'll lose several key features of Starling, including O Ne very important feature-persisted queues.
      • When you shut to a Memcached server, you lose all of its contents. When you were trying to build a reliable queuing system, this is unacceptable. Starling solves this problem by persisting queues across server restarts. You can easily test this. First, place a message into the queue. Next, stop and restart the Starling server. Now try to retrieve the message from the queue. You'll see that the message is still there.
      • Constantly persisting messages does had the negative side effect of slowing down the queue slightly because it had to Tal K to its persistence mechanism. But it's a small price-pay-for-the reliability of being able to recall unsent messages after a system failure or res Tart.
    • Getting Starling states
      • Getting statistics for any system be extremely important in helping diagnose issues with your system and in helping Fine-t Une and refine the system.
      • Example on page 160
    • Conclusion
    • Endnotes
    • Feel this thing will be more useful ah. Intuition
  • Chapter8 AMQP/RABBITMQ
    • Here's what the developers of RabbitMQ has to say about it:
    • "RabbitMQ is a complete and highly reliable Enterprise Messaging system. The RabbitMQ client libraries and broker Daemon can be used together to create a AMQP network, or used individually to BR ing the benefits of RabbitMQ to established networks. "
    • Including parts:
      • What is a AMQP?
      • Installation
      • "Hello World" the AMQP
      • Building a distributed Logger with AMQP
      • Persisted AMQP Queues
      • Subscribing to a Message Queue
      • Topic Queues
      • Fanout Queues
      • Conclusion
      • Endnotes
    • What is a AMQP?
      • AMQP stands for advanced Message Queuing Protocol.
      • The AMQP website answers the questions of "why" and "what" quite nicely:
        • "Though Many networking protocol needs has been addressed, a large gap exists in common guaranteed-delivery messaging mid Dleware. AMQP fills that gap. AMQP enables complete interoperability for messaging middleware; Both the networking protocol and the semantics of broker services is defined in AMQP. "
    • Installation
      • Installation of rabbitmq:http://www.rabbitmq.com/install.html
      • Install Amqp:gem Install AMQP
    • "Hello World" the AMQP
      • Start the RabbitMQ server
      • $ sudo-h-U rabbitmq rabbitma-server
      • In production I recommend running it as a background daemon using the-detached option. I also recommend that you read the accompanying documentation for other configuration information.
      • Page 168: Help with stopping RabbitMQ &documentation
      • code:page169
    • Building a distributed Logger with AMQP
      • Page 178
    • Persisted AMQP Queues
    • Subscribing to a Message Queue
    • Topic Queues
    • Fanout Queues
      • Page 193 does not practice feeling completely do not look in ...
    • Conclusion
    • Endnotes

The book is over for the time being. Basic is the first chapter of serious practice, the back is grass grass over again. Technical books do read a few more times to be able to digest better, and later use or have time to read it again. Thank the author for his hard work:)

Distributed programming with Ruby Reading notes seven Starling and AMQP/RABBITMQ (Part3 chapter7-8)

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.