- Chapter4:starfish (starfish?) This example has the time to change the Linux environment to try it
-
- STARFISH1 bills itself as "a utility to make distributed programming ridiculously easy." I think that's a bit of a overstatement, but the starfish certainly can make distributed programming easier.
- This chapter first looks on how to use starfish to facilitate communication between distributed programs. Then you'll find out more on how we can use it to write MapReduce functions.
- Including 8 parts:
-
- Installation
- Getting Started with Starfish
- "Hello World" the Starfish
- Building a distributed Logger with starfish
- Letting Starfish Shine
- MapReduce and Starfish
- Conclusion
- Endnotes
- Installation
-
- Command:gem Install Starfish
- Show:successfully installed starfish-1.2.1
- Getting Started with Starfish
-
- The documentation for starfish gives a simple piece of sample code to get us into the flow of the library
- Foo.rb
- Run command: Starfish FOO.RB
- However, I ran an error on windows and could not find the server and client definitions ... In doubt because of the system or what, vaguely feel with Ruby's magic methods, after all, just touch Ruby soon. Although I have seen before, "If you want to learn Ruby on rails, do not use Windows, the important thing to say three times such words" first ... In the privacy of the example of this chapter to kneel ...
- "Hello World" the Starfish
- We'll start with writing it using the Starfish binary, the comes bundled with the gem. Then we'll look at the "would need to do" get the same application to work without the "the" binary.
-
- Using the Starfish Binary
- In the brief example, which comes with starfish, we saw the server and client both written in the same file. Although that's great in a sample file, in real life we would most likely want to has those in both separate files, Poten Tially even running on different machines.
- Save it as "server.rb" Command:starfish server.rb
- Of course... I still failed the run ...
- Saying Goodbye to the Starfish Binary
- Well... or failure. This example is in Page93
- Building a distributed Logger with starfish
- Letting Starfish Shine
- MapReduce and Starfish
- The MapReduce design paradigm is simple. It maps a collection of data and then reduces it to a smaller collection.
- Here are two examples of Page104
- Using Starfish to MapReduce ActiveRecord
- Using starfish to MapReduce a File
- Chapter5:distribunaut
-
- For all of its pros, Rails have a few cons as well. I won ' t go into all of them now, but the biggest disadvantage we found is that Rails doesn ' t want to help you write compl Ex Portal applications. It wants to build smaller, simpler applications-at least,at the time it did. With Rails 3.0 on the horizon.
- In addition to building the large portal, we decided we wanted to split our application into many applications. The advantages we saw were smaller code bases, were easier to maintain and separate applications, were easier to s Cale. We also could push updates and new features sooner, because we didn ' t has a gigantic code base to worry on.
- We identified three main problems. First, we wanted to let each application maintain it own set of routing, but we wanted the other applications to be able To use the dynamic routing we had become accustomed to Rails. We didn ' t want to hardcode URLs on the other applications; We wanted them generated by the application they would is linking to. Second, we wanted to share views and layouts among these applications. We didn ' t want to the deal with SVN Externals, GIT submodules, or symlinks. We wanted to being able to quickly say, "Here are a URL for a layout. Render It like you would a local layout. " Finally, we wanted to share models and libraries throughout all these applications without have to worry about packaging them and redeploying all these applications each time we made a bug fix to a model.
- Distribunaut2 is a port of One-third of the distributed features that was found in Mack. In particular, it focuses on making it incredibly easy to distribute models and other Ruby classes. You won't find distributed views/layouts and routes in Distribunaut. The reason is that they was too specific to each of the web frameworks out there, and coding for each one would being a lot O F work.
- including 7 parts:
-
- Installation
- Blastoff:hello, world!
- Building a distributed Logger with Distribnaut
- Avoiding confusion of Services
- Borrowing a Service with Distribunaut
- Conclusion
- Endnotes
- Installation
- Blastoff:hello, world!
- All right... Run Distribunaut_ring_server start error
- There's an example of using Distribunant in the back.
- Building a distributed Logger with Distribunaut
- It's still an example, not running.
- Avoiding confusion of Services
- Earlier, when speaking on application names, I mentioned that names need to being unique to avoid confusion, but I didn ' t Explain what I meant.
- This is primarily for the unique application name problem
- Borrowing a Service with Distribunaut
- Conclusion
- Endnotes
- This chapter seems to have listed the column headings ah ... Okay, look.
- Chapter6:politics
-
- The problem we were running into is this:how do we configure just one machine to run our background jobs, scheduled task s, and other queue-type processing? We didn ' t want to perform these the tasks for a couple reasons. First,we didn ' t want to worry for each of the these processes to step in the other ' s toes, processing the same task. Second, we didn ' t want to add load to each instance, when we could burden just one instance.
- Politics provides modules that allow us to build a self-repairing worker class that can is run on all our instances. But it designates only one instance at a time-to-do the work specified for a given time period. Politics calls this worker a token worker. Under the covers politics uses three different technologies to maintain order in all the worker classes. One of them we already KNOW-DRB. The other technologies it uses is Memcached and MDNS (also known as multicast DNS, Zero Configuration Networking, or Bonjour).
- including 4 parts:
-
- Installation
- Working with politics
- Conclusion
- Endnotes
- Installation
- It seems that the example of this chapter can only look at ...
- To use politics, you must first has both Memcached and MDNS installed on your system. If you is using Mac OS X, you already has MDNS installed. The same goes for most flavors of UNIX.
- Memcached'll need to being installed on the most machines. Instructions on what to does this can is found at http://www.danga.com/memcached/.
- Install command: Gem install mperham-politics-s http://gems.github.com
- Working with politics
- As I mentioned earlier, one of the problems I was had having been making sure that all the processes I had running didn ' t step On each others ' toes and spend cycles doing the same work. This was a common problem when dealing with distributed programming. A Typical example occurs when we is working with distributed message queues. Part III of the This book, "Distributed Message Queues," discusses distributed messaging Queues in greater detail. For now, simply know, "What we discuss," "can make processing those queues extremely effective and POWERFU L.
- What is does this module offer us? The Politics::tokenworker module, when included-a worker class, allows us to create a class that would either process The work we give it and act as the ' leader, ' or patiently sit and wait for their turn to be the ' leader ' while not doing any Work.
- Code stick here, read it.
- PAGE137 has an explanation.
- Token Worker class:
- Conclusion
- Endnotes
- Util Page142
Distributed programming with Ruby reading notes six starfish, Distribunaut and Politics (Part2 chapter4-6)