Sunday 15 July 2012

design pattern asking for advice: push model v.s. pull model -


There are many workers in my application (working on different things as separate processes) and some resources (work unit ). Different workers need to work together. For example, I like W1, W2 and W3, Work unit U1 and U2, as workers. Then W1 requires a process on U1 and U2, which is similar to W2 and W3. Restrictions Different workers can not work on the same work unit at the same time.

I have two designs and want to ask for advice which is a better one.

  1. Push models: By using a central job scheduler to assign different workers to work units, to ensure that different workers do not work on the same work unit are doing;
  2. Drag the model: Each worker will ask a central job scheduler for the work units to process, and the job scheduler will select a suitable work unit which is not being processed by the other worker for the inquired worker is.

I want to know the pros and cons of each design. And one of my biggest concerns - loose coupled design (this is my main goal, but not the only goal). I'm not sure that better suitability in push models or pole models (option 1 is more loosely coupled)?

Thanks in advance, George

In addition to this, the "bridge" model can be more "decoked" because the variable of "load" is kept locally, whereas in the "push" model Needing a communication protocol (and overhead) to communicate this state to someone Will.


Think about the success of the "bridge" model in the auto industry: it went from the traditional "push" model where the goods are difficult to track and now the successful and ubiquitous "bridge" model


When it comes to scaling, you can create an intermediate layer of "scheduler", which is "voting" base workers for jobs from the above layer, now in a divided way the intermediate layer Can interact with


Note that a model requires coordination communication protocol: this is the nature of the coordinate protocol It is different in "push model", each worker's "load" Factor "is an additional control loop required to report / report a poll. As a scale of the system, more bandwidth is required, more state on the scheduler side, greater latency etc.


No comments:

Post a Comment