samedi 30 novembre 2019

How long will it take at least a simple web service in Java?

Suppose that we make a very simple web service in Java, with an embedded server like Jetty. A simple GET by id like:

GET /entity/{id}

Suppose that to response, the web service need to access some in memory collection (a cache list for example), get the entity, serialize the object into JSON, and reply with a HTTP Code 200 and the entity.

No more!

How long is reasonably for this service to take, taking into account all the pipeline execution that Java has to do: handlers, interceptors, etc.

I know that the answer depends on hardware resources (CPU, RAM, etc), but anyway I would like to know an estimate answer.

For example:

  • 1 millisecond is a racional duration or it's not posible at all?

  • Can this service perform in the order of the microseconds? And nanoseconds?

My goal is to know how much we can optimize a service and when it could be said that we reach the maximum performance limit.

Note that I mean the time of the service itself, measured within the host. I do not mean time from the client's point of view, which will be much more variable due to aspects of the network that do not interest me in this context.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire