Writing Asynchronous Non-Blocking Rest API using JAVA. Handle large traffic, improved application performance, and responsiveness...
During an API call from a client, the server creates and assigns a thread of that request. This thread waits and is appointed until requests are served to that client.
Each server can open a limited number of threads, and if that number exceeds, then new clients request will store in the request queue of that server.
For the Tomcat server, its default number of threads
maxThreads is 200, representing the maximum number of concurrent threads allowed to run at any given time.
There are other metrics,
maxConnections, representing the total number of concurrent connections that the server will accept and process. Any additional incoming connections will be placed in a queue until a thread becomes available. The default value for
NIO/NIO2 mode is 10,000 and
APR/Native is 8,192.
Another metrics is
acceptCount, which represents the maximum number of TCP requests that can wait in a queue at the OS level when there are no worker threads available. The default value is 100.
For a high traffic application, If a request takes much time or takes a long time to serve, it will create a huge problem. To overcome this thread management problem, we can use asynchronous programming.
According to visualstudiomagazine.com, the definition of asynchronous programming is
Asynchronous programming is a means of parallel programming in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress.
What is REST? The REST acronym is defined as a “REpresentational State Transfer” and is designed to take advantage of existing HTTP protocols when used
I’ve been working with Restful APIs for some time now and one thing that I love to do is to talk about APIs.
We all know there are multiple ways to create a Rest API. You can use Flask, Django, Rails or Sinatra to do so, but this article will focus on creating said restful API endpoint using Java, Spring Boot and Spring Data Rest.
crud operation using rest api, laravel 7 rest api with passport tutorial, create rest api with authentication using passport tutorial, how to build restful api in laravel, laravel rest api crud, how to call api in laravel, laravel rest api crud, laravel get data from api, laravel 7 api tutorial, rest api in laravel
How to Validate an Email Address in Java. Perform validation of an email address: check for syntactic correctness, identify the mail server, contact the server to validate an account without sending any emails.