“I feel the need, the need for speed” is not only a famous quote from Tom Cruise in the movie Top Gun but it also reflects the feelings of many IBM i users who are API enabling their applications. Whether they are adding new web or mobile user interfaces and must try to match the response time of their green screen applications or they need to rapidly process large volumes of incoming API traffic, it is critical that API execution is not slowing them down.
Since loading a webpage can often require multiple API calls and other processing, API experts say that each API call needs to be executed in milliseconds to provide acceptable user response. For large volumes of machine-to-machine requests, speed is even more important. If you can’t handle the load of incoming API requests, you may simply lose business.
To avoid frustrating your users and missing opportunities, your APIs must execute functions and relay data extremely rapidly. It’s not an easy task. The APIs must authenticate the users, determine what they are allowed to do, turn the API call into a program call or access to the database, transform the data from open formats to IBM i formats and perform business logic. Fortunately, there are great ways to optimize API performance on the IBM i.
The need to transform data from JSON, XML and other formats to IBM i data structures and field types can be one source of delay. Since an API roundtrip might include a transformation on the way in and another on the way out, you are paying this performance price twice. These transformations can be dramatically faster if done in JavaScript rather than in RPG. In one benchmark test we ran recently with a JSON transformation at a customer site, the JavaScript transformation was 20,000 times faster than a transformation performed with RPG. If you are processing a large volume of API requests, that difference can be significant.
Using the connection pooling functions of the IBM i ODBC connector can also speed up API processing. With connection pooling, API requests can be routed to an available connection rather than waiting for a previous request to complete. This allows you to handle many API requests simultaneously.
If you have very high volumes of API requests, you might want to add additional API servers to horizontally scale your API processing capacity. Load balancing functions can distribute the API traffic evenly across your servers. This is especially effective if you can run your APIs on low cost Windows or Linux servers attached to your IBM i. If those servers are on your internal network, the extra hop to your IBM i should not add much latency.
Using these techniques will ensure that the users accessing your APIs will get the rapid response they need. And your systems will be able to handle the growing volume of API requests.
If you would like to know more about ensuring your APIs are performing at top speed, contact us at Eradani. You can reach us through our website at www.eradani.com or via email at: info@eradani.com.