Skip to main content

Patterns independent of scale: the pull model

Posted by eitan on June 12, 2003 at 12:03 PM PDT

i'm sitting and listening to the TS-1560 technical session on the ws-i basic profile. we're looking at a diagram of a sample application: consumers pulling goods from a retailer shelf, in turn triggering the retailer to pull inventory items from a warehouse. inventory levels reaching a minimum threshold then signal manufacturers to increase production of a specific item to replenish inventories.

suddenly it strikes me: at an entirely different scale and domain, we see online users making http requests against servers. but typically what we see there is a push model: the http server pushes the request to an application server which then requests information from a database server. applying our pattern from the world of manufacturing where a good is pulled from manufacturer to consumer, we see a more natural solution:

an end user makes an information request, the http server is the retailer; it can satisfy that request if its cache (inventory) contains the item (though caches don't typically get low, they do often get stale, similar to consumer goods). the cache saves an expensive trip to the warehouse.

what if instead of pushing the request to the app server, we were to post the request to a javaspace or a jms server. then workers (manufacturers) could pull the items off the space (or queue) and service the request. so what we see here is the same pattern manifesting itself at two levels of scale. analyzing the solution further we can see it's a good one, because it naturally supports issues such as the ability of the system to serve larger numbers of requests by simply adding workers, without having to revise the "design." it's still the same pattern. we can make more inferences too in terms of the natural resilience of such a solution: if a worker dies the system is still running; if one worker is "more able" than another, it will naturally pull proportionally more requests than its fellow worker.

so the fit is natural, organic almost. and we say that it is good. :)

the morals that i'd like to suggest as they pertain to javaone are and the sessions i've attended this morning (which were TS-1624 [delegating jfc data models to collections], TS-1381 [an intro to jini] and TS-1560 [ws-i basic profile]):

  • attend as many sessions as you can: they will trigger all kinds of thoughts and ideas (if you're like me, write them down before they vanish from short-term memory)
  • look for synergies possibly emerging from combining various technologies
  • if you haven't done so yet, read "the timeless way" (this book is not about software development, but applies quite well to software development)
  • if like me, you "have not had the time" to take a good look at jini, i recommend it very highly. jini is one of those "substance over hype" value propositions, and embodies simplicity.

Related Topics >>