====== Print Performance Factors ====== Each step in the [[https://www.savapage.org/docs/manual/ch-webapp-user-main-print.html|SavaPage Proxy Print]] Workflow has critical factors that influence overall performance. ===== Printing Workflow ===== The major steps in the workflow in a nutshell: ^ Step ^ Actor ^ Action ^ | 1 | User | Send Print Job request to CUPS Scheduler. | | 2 | CUPS Scheduler | Schedule print spooling. | | 3 | CUPS Spooler | Hold print job in queue, send to Filter when Printer is available. | | 4 | CUPS Filter | Convert PDF into PDL((Page Description Language (PDL) is a computer language that describes the appearance of a printed page in a higher level than an actual output bitmap.)) (PostScript, PCL, etc.) and send to Backend| | 5 | CUPS Backend | Send PDL to the Printer. | | 6 | Printer | Convert PDL to bitmap dots on paper. | Each step is detailed in a section below. ===== User Request ===== The PDF document to be printed and the printer settings, chosen by the user, are translated to an IPP Print Job request and, via HTTP POST and ''application/ipp'' content type, send to the CUPS Scheduler. ===== CUPS Scheduler ===== The maximum number of simultaneous clients and print jobs that can be supported is primarily limited by the available server memory, [[https://www.savapage.org/docs/manual/ch-tuning-ulimit.html|file descriptors]], and CPU. The CUPS scheduler itself imposes no hard limits. However, if you are running into performance problems with disk space, memory and CPU usage, editing one or more directives inside the ''/etc/cups/cupsd.conf'' file may aid the situation. See [[https://www.cups.org/blog/2005-05-10-how-to-restrict-disk-memory-and-cpu-usage.html|How To Restrict Disk, Memory and CPU Usage]]. ===== CUPS Spooler ===== ^ Factor ^ Risk ^ Measure ^ | Concurrency | Many user requests within a too short time window lead to long waiting times. | Add CPU Cores, so CUPS filter processes can run concurrently. \\ \\ For example, a university uses 12 CPU cores for load balancing CUPS filtering for thousands of students printing with SavaPage.| ==== CUPS Printer Classes ==== A CUPS Printer Class is a group of printers, and acts as a regular printer from a user's point of view. When printing to a class, CUPS will redirect the job to one of its members. Which member would depend on user rights or which printer currently is available. ^ Factor ^ Risk ^ Measure ^ | Concurrency | Many user requests to a single ''smb:'' printer, within a too short time window, lead to long waiting times. | A printer class, with multiple ''smb:'' members, all having the same printer URI, can significantly enhance printing throughput to a single Windows print queue. | ===== CUPS Filter ===== Filtering PDF to PDL is a CPU intensive process: //CPUs with higher clock rate will get the job done faster.// ^ Factor ^ Risk ^ Measure ^ | Content | Filtering multi-layered PDF (CAD), graphics and special fonts, takes longer than plain text. | CPU with higher clock rate. | | Volume | Filtering many pages take longer. | Set limit on page volume to print freely. Print large PDFs by Job Ticket only. | | Settings | Filtering for higher print resolution take longer. | Set low resolution (300 dpi) as printer default. | | Driver | Filtering with vendor drivers may take many times longer than with Generic PostScript drivers (see table below). | Test vendor specific CUPS driver before purchasing printer. Or, use Generic Postscript Driver when simple printing (without vendor features) is sufficient. | The table below shows some CUPS filter duration metrics of mixed content PDF with different PPD drivers. [[https://www.savapage.org/download/PPD/savaspool.sh|savaspool.sh]] was used to capture the spoolfiles. ^ Content ^ Driver ^ Pages ^ 3.40GHz ((Intel(R) Core(TM) i7-4770 CPU)) \\ m:ss ^ 2.67GHz ((Intel(R) Core(TM) i5 CPU 750)) \\ m:ss ^ 2.00GHz ((Intel(R) Xeon(R) CPU E5-2620)) \\ m:ss ^ | text + graphics | Generic PostScript Printer | 9 | 0.01 | 0:02 | 0:03 | | | Xerox D125 Copier/Printer (PS) | 9 | 0:03 | 0:04 | 0:06 | | | Canon iR-ADV 8285/8295 UFR II | 9 | 0:07 | 0:10 | 0:16 | | \\ |||||| | text + graphics | Generic PostScript Printer | 51 | 0:18 | 0:35 | 0:51 | | | Xerox D125 Copier/Printer (PS) | 51 | 0:58 | 1:50 | 2:35 | | | Canon iR-ADV 8285/8295 UFR II | 51 | 1:48 | 3:25 | 5:00 | ===== CUPS Backend ===== The CUPS backend sends the filtered PDL data to the printer, over the network or via usb, serial or parallel port. The Printer URI start with a backend identifier, like ''socket:'', ''ipp:'', ''ipps'', ''http:'', ''https:'', ''lpd:'', ''serial:''. Printing to a Windows Print Server queue is done with the Samba ''smb:'' backend. ==== papercut: ==== As backends can be //chained//, PaperCut Print Management (([[https://www.papercut.com/|PaperCut]] is a popular Print Management System. It is proprietary software, but a hardware independent solution. It is often used in combination with SavaPage.)) has its own ''papercut:'' backend to put in front of any other backend. So, in the ''papercut:socket:%%//%%192.168.1.66'' URI, the ''papercut:'' backend is the first to receive the filtered PDL data. In this way PaperCut checks print job parameters against custom print policy first and, when printing is approved, sends the PDL data to the ''socket:'' backend. To analyze the print job, ''papercut:'' must process the complete incoming PDL stream in advance, before it can stream the PDL to the next backend in line. //In some cases, this policy can seriously delay printing, since ''stdout'' of the CUPS filter is not one-to-one streamed to ''stdin'' of the final backend sending data to the printer.// As an example, the table below shows the 2-step CUPS filter process of the Canon iR-ADV 8285/8295 UFR II driver on a 2.67GHz CPU for a 51 page text + graphics PDF document. Metrics were obtained by observing ''top'' and printing with [[https://www.savapage.org/download/PPD/savaspool.sh|savaspool.sh]] backend. ^ Step ^ Program ^ input ^ output ^ m:ss ^ | 1 | [[https://en.wikipedia.org/wiki/Ghostscript|Ghostscript]] | PDF | PostScript | 1:35 | | 2 | Canon UFR II Driver| PostScript | OpenPrinting Vector | 1:48 | //In the Canon case, the papercut: backend introduces a 1:48 m:ss extra delay before the first page starts printing.// ==== Network ==== Network speed is a factor when sending PDL data to a network printer. ==== Disk space ==== When printing to a PaperCut hold/release CUPS queue, spool files are stored to disk waiting to be released. These spool files can be quite large: sizes of 1GB+ are no exception. If the hold/release time-out is long (a day or more), you need to plan for additional disk space. ===== Printer ===== When the PDL data (spoolfile) arrive at the printer it must check and prepare all hardware involved, before it starts printing the first page. Like, is paper path clear (any paper jams), are media sources and output bins ready, etc. When in sleep mode, it must warm up the fuser. This might all take a few seconds, or longer, depending on how fast the printer is. The rendering of PDL into bitmap dots-on-page might be a slow process: if the printer is low on memory, it must swap to disk or wait for a page to finish, before it can start rendering the next one. When memory or disk space is insufficient, the printer may reject parts of the PDL, and print error messages instead. For example: ERROR: ioerror OFFENDING COMMAND: image STACK: --nostringval-- -mark- -mark- -mark- Note: Memory or disk space related errors often occur randomly: the same document causing an error might print correctly when tried a second time. Finally, print job options like duplex, color, high quality, and finishings (staple, hole punch, booklet) have an overall impact on the page-per-minute performance of the printer. ===== Conclusion ===== - The higher the CPU clock rate, the faster CUPS filtering works. - The more CPU cores, the better the system can respond to concurrent print requests. - Test CUPS printer driver performance before deciding on a printer purchase. - ''papercut:'' backend can slow down first page printing. ===== Further reading ===== * [[https://wiki.debian.org/Printing| Debian Printing Portal]] * [[https://wiki.debian.org/PrintingGlossaryandIndex|Debian Printing Glossary and Index]] * [[https://en.opensuse.org/SDB:CUPS_in_a_Nutshell | openSUSE Wiki • CUPS in a Nutshell]]