Threading For Parallel Processing of Documents

Blue Prairie Forms allows for a wide array of configuration options.   The two basic method of speeding up printing is to create additional phantom threads so that many job scan be sent to your printers simultaneously.  To understand how to properly configure threading, you should understand what it does.  The following diagram will be referenced below.

Document Creation Flow (from left to right)

  1. Your program calls the BP Forms API to generate a document.
  2. The document is written to a queue directory. 
  3. The queue directory is normally a path on the MultiValue server such as /dbms/BPIFORMS/bpi_forms/queue/bpiform1
  4. One or more phantoms may poll the queue directory and attempt to process the documents placed into it in first-in, first out order.  The first phantom to find and lock the document is the winner and will process the document.  The other phantoms will observe that the document has been locked by the winning phantom and will skip the locked document and move onto the next available document.
  5. The winning phantom will communicate with the BP Forms server.
    1. It will check to see that the server is alive
    2. It will check to ensure that the printer name to which the document is to be directed exists on the BP Forms server (in CUPS)
    3. It will check to ensure that the mount that allows the BP Forms server to reach into the queue directory is working
    4. If all of these checks are successfuil, the phantom will send a command to the BP Forms server to start open office, load the document and print it to the targeted printer.
  6. Open office loads the document and prints it to the specified printer
  7. CUPS (Common Unix Printing System) communicates with the printing device (e.g., PDF printer, Physical printer, etc) and delivers the print job to the printer
  8. Open office closes and notifies the phantom thread that the print was successful
  9. The phantom returns to polling the queue directory.

What can be done to improve print performance?

Some printing proiblem are at the printer hardware or network level.  It is best to run printing tests independent of BP Forms to ensure that the performance problem is not network, WAN or printer device related.

If these tests show that the printer is working well, then the problem could be the speed at which the system can deplete the Queue Directory.  BP Forms allows for one or more phantoms to process a single queue directory.  Remember that if you place most of your documents into the same queue directory and have only one phantom polling it, then the document printing time may be impacted because BP Forms must process the printing of the document serially in first-in, first out order.  If a large document is queued, it may take some time for open office to open , print and deliver it to CUPS. 

However, if you run several phantom threads all polling the same queue directory, then printing will be parallelized and documents will not become 'stuck' behind a large print job.  If a large print job is being processed, the other phantoms that process that queue will simply run ahead to the next available document and process it.

If you print jobs must be processed in the order that the print jobs are created by your application, then it is best to have a single phantom thread processing that queue.  But for most printing, the order of the print jobs appearing on the printer(s) is less important than the speed of the printing.

For more information about configuring phantom threads, see Administrative Interfaces.