With the microservice architecture, based on your experience do you find it would work well with high volume processing that comes from batch? When I think of micro services, I imagine a lot of overhead from security between calls and the human process of managing many microservices. Do you cover that in your book ?
Great question. Microservices are very well suited for batch processing. Since microservices are small, independent and easily deployable chunks of code, you can easily scale up to large numbers of instances to process records coming from a batch. A few things to keep in mind:
1. With Java-based microservices you can still leverage multi-threading to take advantage of multiple CPUs on your server. You still get a lot of advantages in taking advantage of the underlying machine. My team works exclusively in the integration and back-end layer so we often times have to be creative with threading and queuing because our data consumption patterns can wildly change.
2. If you are working in a cloud (e.g. AWS) you can spin up microservices instances and use different classes of machines based on the workload you are process. So for instance if you do relatively light batch processing with services X during the day and your heavy volumes during the evening, it is very easy in a microservices environment spin up additional service instances. You can even use different classes of machines with more CPU or higher IO throughput. We use this approach in a slightly different manner. We get most of our volume during the day (we are message-base, not batch) so we spin up extra machines in our dev and test environments. Then after hours we spin down to a very small footprint to save money so that we are not burning dollars on unused machine capacity.
3. Microservices are extremely well suited to horizontal scaling because their small footprint means instances can spun up very quickly. If you are using Docker, additional services can be spun up in seconds to handle load.
4. Batch processing can put a lot of pressure on your security infrastructure, but most security platforms allow you to perform near and far caching of application credentials so that you do not have to pound on security servers. For instance,
Apache Shiro will allow you to maintain a cache and a token after initial authentication so that you do not have to services authenticate credentials on each request. One of the lessons I have learned with microservices is that caching is king. As it can greatly reduce the amount of load on many services.
I hope I answered your questions.
John Carnell - Senior Engineer, Genesys PureCloud Division
Author of Spring Microservices in Action
One way to improve performance regarding security, like what John mentioned, is to use JSON Web Tokens with public/private key signing. This removes the need to have each service validate an OAuth token with the auth server since instead the services can verify the signature on the JWT.