16
Tue, Apr
5 New Articles

Lab Notes: How to Run Fast in a Slow World

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

The question of how to run fast in a slow world is still appropriate to ask about the AS/400. Machines keep getting faster, but we keep filling them up with more applications, more sophisticated uses, more volume, more overhead, and more whatever.

We've all heard the announcement from IBM. RISC is here, and the price performance sounds good. But for many of us, it's just another thing to throw at the door to keep the wolves away for a while. It won't be long before even a shiny new black-box, RISC-based AS/400 gets busy. So what's the answer? Well, maybe it's time to sit back and think about what you are doing and how you could do it smarter from a performance viewpoint.

When the AS/400 architecture (first available on S/38 in 1980) started to be installed by lots of users, it became quite clear that the way to make the architecture run fast was to write big programs that opened up the required files and kept them open. To run fast, you had to do as much work in a single program as possible. It was also quite clear that the architecture required a much bigger engine than the early S/38 models offered.

Get Ready to Run

Times have changed. The hardware has caught up and the emphasis on a single large program has been minimized to some degree with both hardware and software alternatives. However, the basic architectural comment remains true. Opening files, executing CL commands such as Override Database File (OVRDBF), calling programs?all of the "get ready to run" stuff is still relatively slow on the AS/400. There are plenty of things you should do only once if you want your application to run fast.

The Integrated Language Environment (ILE) probably will improve CALL performance in some cases. However, the concept of writing modules that get bound together is foreign to many AS/400 programmers. ILE includes the concept of service programs, which allow binding of programs at execution time. Binding will be more overhead. For example, you wouldn't want to crank up an activation group and do a lot of binding for a single transaction.

Perhaps one of the best internal designs that was developed for the AS/400 was the concept of being able to handle lots of jobs that have a brief need to run and then go back to sleep again. This is very typical of interactive use. The concept of the Process Access Group (PAG) helps make this work effectively on the AS/400. The PAG is still a mystery to many programmers. The PAG is essentially the place where the system stashes the stuff that is unique to a job. Programs are used by different users (read-only code), as are database pages and indexes, but the identification of which program is running, what instruction it is on, and what the variables are is unique to a job.

The system handles much of the PAG on a mass transfer basis (mostly a "whoosh"), which means a big glob of the PAG comes quickly into main storage when you need it (see 1).

The system handles much of the PAG on a mass transfer basis (mostly a "whoosh"), which means a big glob of the PAG comes quickly into main storage when you need it (see Figure 1).

This technique for the PAG requires lots of main memory, which was certainly not available in the early days of the S/38. Most of the other transfers in and out of main storage are done in much smaller increments, such as page sizes. This is particulary true of the "get ready to run" stuff.

So, because the system handles the PAG very efficiently but does not do an efficient job on the "get ready to run" stuff, the natural conclusion is to get everything you ever wanted to do up and ready in the PAG. That way you do it only once.

But another "gotcha" appears: you can develop a huge PAG and kill the system performance trying to move the PAG in and out of the main storage. Performance is like a balloon. If you squeeze it in one place, it tends to pop out in another place. The trick is to have it pop out where it doesn't hurt you.

Some AS/400 programmers don't know how to write a solution in which everything is open and ready to go. Some know how to do it, but don't because of the "huge PAG syndrome." As applications get more complex (and users wear more hats because they need to interrupt what they are doing to do something different), the pressure on the system to do more "get ready to run" stuff keeps increasing. The net is that most systems spend too much time doing "get ready to run" stuff and not enough time on the "do the transaction" stuff.

So, What's the Answer?

There is never one answer on performance, but let me review two underused functions that have been around for a long time, but still don't get enough play.

This isn't a full course on performance, but try to keep a few things in mind as you consider the conclusions:

? To run fast in a slow world, you have to minimize the number of times the "get ready to run" stuff is performed by the application (open files, initiate programs, run override commands). The ideal solution is once a day.

? The system is efficient with the PAG and is able to handle many jobs becoming active for short periods of time.

So here goes with two of my favorite solutions.

Group Jobs (or Workstation Key)

Yes, I know it's been around awhile and it sounds old hat, but think about group jobs for a moment. They offer the opportunity to split the PAG into mulitple chunks (a separate PAG for each group job) so you can afford to keep more programs and files open. The user selects an option or presses the Attention key to get a menu of available jobs. (For more information, see "Getting Started with Group Jobs," elsewhere in this issue of MC.)

The system operates efficiently in terms of suspending one group job and invoking another one. It's the same code that "whooshes" the PAG in and out. The user can go right to the function that is needed and is ready to go with open files, programs already initiated, and overrides set. You do have to pay a bigger price the first time, but after that, it's fat city.

The important question to ask here is, "Can the system switch to another group job faster than a single job could end its current function and do the ' get ready to run' stuff for the new function?" Remember that switching jobs is a strong suit of the architecture, and "get ready to run" is not.

A design for group jobs can vary significantly from simple to very complex. It's easy to get the users confused about where they are with a lot of options and Attention key menus. A simple approach may be more effective.

If you've never tried group jobs, you can do something very simple with the TAA Tool called ATNPGM. This tool is both in QUSRTOOL and in the TAA Productivity Tools product. It lets you flip-flop between two group jobs. Give it a try and convince yourself that the system can make the switch very quickly.

A similar alternative exists for some workstation devices (see 2). These devices allow a configuration that tells the system there is more than one device and allows a key to switch to another job. This is a slightly faster transfer, but it is more limited in number than group jobs.

A similar alternative exists for some workstation devices (see Figure 2). These devices allow a configuration that tells the system there is more than one device and allows a key to switch to another job. This is a slightly faster transfer, but it is more limited in number than group jobs.

Data Queues

I know you've heard this one before too, but the number of people who use data queues is still fairly small. Data queues offer the fastest method of communicating between two jobs. It's a way to offload work from one job and get it performed in another job. The traditional method of doing this is with the Submit Job (SBMJOB) command. But, if you want to talk about overhead, SBMJOB has a lot of it. The system has a lot to do to establish a job. Then, your application does the "get ready to run" stuff and, finally, you get to process. This cycle is repeated for every batch job.

With data queues, you can start a never-ending batch job that does the system "start a job" function and the application "get ready to run" stuff once. Then, the job waits for an entry to appear on a data queue. The simplest form of a data queue job is a one-way street in which you just keep sending requests without getting any feedback to the original application (same concept as a batch job). 3 shows this in more detail.

With data queues, you can start a never-ending batch job that does the system "start a job" function and the application "get ready to run" stuff once. Then, the job waits for an entry to appear on a data queue. The simplest form of a data queue job is a one-way street in which you just keep sending requests without getting any feedback to the original application (same concept as a batch job). Figure 3 shows this in more detail.

The more complicated form is the one in which the application wants to hear back whether the function worked or failed. This normally involves a second data queue or one for each job that is communicating to the service job.

If your application has some things it can do asynchronously, a data queue can be an excellent choice. You can offload work out of your interactive application to a single job that is dedicated to peforming a service function for you or multiple users. A single job dedicated to a function with its files open and ready to go can turn out a lot of work.

A Matter of System Direction

Good old group jobs and data queues don't sound very exciting, but they can do a lot for you. Both functions provide a way to get an application solution dedicated to solving a problem rather than mostly dedicated to causing a lot of overhead. Do the "get ready to run" stuff once and let the system concentrate on doing your applicaton function.

When you think about performance design, you also have to consider the direction the system is likely to go. If you look at the past, you can tell that the direction is toward bigger main memory and faster CPUs. Sure, disk processing has gotten faster, but not by the same magnitude that the size of main memory and raw CPU horsepower has increased. This is leading right into one of the strong suits of the AS/400, and that is the ability to handle lots of PAGs and move them in and out of the system quickly.

Jim Sloan is president of Jim Sloan, Inc., a consulting company. Now a retired IBMer, Sloan was a software planner on the S/38 when it began as a piece of paper. He also worked on the planning and early releases of the AS/400. In addition, Jim wrote the TAA tools that exist in QUSRTOOL and is now the owner of the TAAProductivity Tools product. He has been a speaker at COMMON for many years.

Lab Notes: How to Run Fast in a Slow World

Figure 1: AS/400 Performance Access Group (PAG)


Lab Notes: How to Run Fast in a Slow World

Figure 2: Workstation with Multiple Session Support


Lab Notes: How to Run Fast in a Slow World

Figure 3: AS/400 Data Queue


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: