2

Currently, I have a POST end point and the end point accepts an octet-stream. So, I'm wondering where the input-stream gets stored when multiple request keep hitting the server (multiple input-streams cached at network level ?). Do these streams of data packets reside on network and if yes, what happens if my bandwidth reaches 100%. Also, I am only going to process a request upon validation. So, in such a case I don't process an input-stream if authentication fails. Is this a good approach, considering my applications minimal heap configuration (lets say 2GB). Also, wondering whats the trade-off going to be between memory and bandwidth. I'm using JERSEY implementation (JAVA app) and have deployed the REST service on Tomcat.

V1666
  • 185
  • 3
  • 14

1 Answers1

1

When a RESTful API that uses HTTP as a transport protocol, then the data streams don't get cached in the network layer, as the HTTP protocol is stateless.

With regards to the authentication, before posting the huge load of data, you can do Basic HTTP Auth, by which your client will retrieve a temporary session token and then post the data.

If you are really concerned that you can reach the network bandwidth, then there are several options you can try to apply:

  • Implement asyncronous communication between the client and the server. This way the server will retrieve the input as messages when it's ready to serve them.
  • Turn on HTTP compression
  • Stream the POST content

More info:

Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
  • When I say cached, I meant to ask if they are on the network bandwidth. Isnt the bandwidth going to be congested when multiple requests keep coming in and what if I run out of bandwidth ? – V1666 Oct 24 '18 at 07:22
  • I think in that case those requests will be lost. – Konstantin Yovkov Oct 24 '18 at 07:27
  • So, the Inputstream is going to reside on the servers network then ? If yes, what would be a good approach for load testing the service and for defining SLA's ? – V1666 Oct 24 '18 at 07:31
  • Sorry, I don't know that... I will follow the discussion for more answers. – Konstantin Yovkov Oct 24 '18 at 10:41