At the Forge - Incremental Form Submission

 in
A creative solution for solving Web service performance bottlenecks, or “ix-nay on the ottleneck-bay”.

The key to making all this work is shown in Listing 3, which provides the code for our XML-RPC server. We begin by reading from a simple cache of English words and their Pig Latin equivalents. Again, it seems silly to store things in this way, when it's much faster simply to write the code that handles the Pig Latin rules. If you imagine that each translation takes several seconds, you can see how things could pile up quickly.

There are several things to notice in this program. One of the first is the use of an on-disk cache to store recently processed inputs. (Please don't try to emulate the simple and foolish way in which I implemented this; I ignored locking and permission issues.) The cache itself is a simple text file containing name-value pairs. Before computing the Pig Latin translation of each item, the Web service consults the cache. If the word is in the cache, the service grabs that value and almost immediately returns the translated value.

If the word isn't in the cache, it translates the English into Pig Latin, storing the values for the next time around. Again, this ensures that we have to work hard (that is, translate the word into Pig Latin) only if it fails to appear in the cache.

If you've never programmed in Ruby before, you might be put off a bit by this line:

words.map {|word| word.to_s}.each do |word|

This tells Ruby that it should take the array named words and turn each of its elements into a string. (If the element already is a string, it is unaffected.) We then iterate over each string (word) in the array, assigning the local variable word to each element in sequence.

With Listings 1, 2 and 3 in place, you should be able to translate sentences from English into Pig Latin without too much difficulty. You enter the English words into the HTML form, the server-side program calls the Web service, and the Web service takes care of things quickly.

______________________

Webcast
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers

Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.

Learn More

Sponsored by AMD

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState