Mailcaster Operation

This section contains an example Mailcaster run, illustrating some of the concepts discussed in this documentation.

In this example, the system uses seven Mailcasters, numbered MC1 through MC7.

Image: Mailcaster diagram 1

This diagram shows the seven Mailcasters with their minimum and maximum job sizes.

Mailcaster diagram 1
  • Mailcaster 1 is Small Job Only, with a minJobSize of 1.

  • Mailcasters 2 and 3 are Small Job Priority, with minJobSize=200 and maxJobSize=2000.

  • Mailcasters 4 through 7 are Large Job Priority, with minJobSize=2000 and maxJobSize=5000.

  • For Mailcasters 2 through 7, percentageJobSize is set to 4.

  • smallAudienceThreshold is set to 2000.

  • Automatic Recovery is on.

For the example, the mail queue (in the PS_RY_BULK_JOB table) contains three jobs:

  • Job 101 contains 11,000 emails, is_small_job is n, status is P_QUEUED.

  • Job 102 contains 135 emails, is_small_job is y, status is QUEUED.

  • Job 103 contains 200,000 emails, is_small_job is n, status is P_QUEUED.

All the Mailcasters have already been started. In this example, Mailcaster 1 (the Small Job Only Mailcaster) wakes up first and checks the queue for a job.

It looks at Job 101 first, but skips it because it is not a small job.

Next, it checks Job 102. At 135 emails, is_small_job is y, so Mailcaster 1 begins processing it and changes its status to RUNNING.

Image: Mailcaster diagram 2

This diagram shows Mailcaster 1 processing Job 102.

Mailcaster diagram 2

Next, Mailcaster 4 wakes up. It checks the queue and finds Job 101 waiting in P_QUEUED state. Because there are no large jobs in RECOVERING state, hanging, or in P_ASSIGNING state (the first three priorities for Large Job Only Mailcasters), it takes Job 101. It updates the status of Job 101 from P_QUEUED to P_ASSIGNING and inserts a new job, Job 104, in the PS_RY_BULK_JOB table with status RUNNING.

Because Job 101 is larger than the Mailcaster 4 maxJobSize of 5000, it will have to be broken into child jobs. To determine the size of Job 104 (the child job), Mailcaster 4 first checks the percentJobSize parameter, which is 4. Dividing 11,000 emails into chunks of 4 percent each results in jobs of 440 emails. Because this value is smaller than the Mailcaster minJobSize of 2000, the Mailcaster instead sets the child job to 2000 emails and begins processing it.

The queue now looks like this:


Job 103 (QUEUED)

Job 104 (RUNNING)

Job 101, which formerly had 11,000 emails, now has 9,000 remaining.

Image: Mailcaster diagram 3

This diagram shows jobs being processed by Mailcasters 1 and 4, and also shows the current contents of the queue.

Mailcaster diagram 3

Next, Mailcasters 5, 6, and 7 wake up in order, check the queue, and in each case they find Job 101 still in P_ASSIGNING state.

Mailcaster 5 creates child job 105 with 2000 emails.

Mailcaster 6 creates child job 106 with 2000 emails.

Mailcaster 7 creates child job 107 with 2000 emails.

In each case, the jobs are set to RUNNING and the Mailcasters begin processing them.

At this point, parent job 101 has 3000 emails remaining (9000 – 6000).

Note: In all three cases, Mailcasters 5 through 7 ignored the percentageJobSize parameter because its result was smaller than the Mailcaster’s minJobSize.

Image: Mailcaster diagram 4

This diagram shows that jobs are now being processed by Mailcasters 1, 4, 5, 6, and 7, and again shows the current contents of the queue.

Mailcaster diagram 4

Mailcaster 2 wakes up and checks the queue. Although Mailcaster 2 is a Small Job Priority Mailcaster, there are no small jobs available so it discovers Job 101 still in P_ASSIGNING state. Checking percentageJobSize, it finds that the result is smaller than its minJobSize (4% of 3000 is 120, or less than 200) so it creates Job 108 with 200 emails.

Mailcaster 3 wakes up, checks the queue, and creates Job 109 with 200 emails.

Parent Job 101 now has 2600 emails.

Image: Mailcaster diagram 5

This diagram shows that all seven Mailcasters are now processing jobs, and it shows the contents of the queue.

Mailcaster diagram 5

Mailcaster 1 finishes processing its job and marks it FINISHED. It checks the queue, but there are no small jobs available for processing. It goes to sleep, and will wake up again in 1 minute to check again.

Mailcaster 4 finishes processing its job, marks it FINISHED, and checks the queue. It finds Job 101 still in P_ASSIGNING state, so it creates Job 110 with 2000 emails, marks it RUNNING, and begins processing it.

600 emails remain in Job 101.

Image: Mailcaster diagram 6

This diagram shows that Mailcaster 1 has finished processing, and shows the contents of the queue.

Mailcaster diagram 6

Mailcaster 6 wakes up and creates a new child job to process the remaining 600 emails in Parent Job 101. Job 101 is now in P_ASSIGNED state—all the jobs have been assigned, but have not yet finished processing.

All the Mailcasters processing children of Parent Job 101 finish successfully. Job 101 is marked P_FINISHED.

Image: Mailcaster diagram 7

This diagram shows that all Mailcasters have finished processing Parent Job 101, and that only Job 103 remains in the queue.

Mailcaster diagram 7

When the Mailcasters next check the queue, they will begin dividing up and processing Job 103. Mailcaster 1 (the Small Job Only Mailcaster) will be idle until another small job is added to the queue.