Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do common web services client use a proxy

I've noticed that most architectures that acts as a web service client uses a proxy to communicate with the rest server? While it is possible to access a rest service without a proxy server, one example I've read is this where it uses a proxy server to communicate with its rest server are there any advantages of using a proxy to access a rest service?

like image 608
user962206 Avatar asked Mar 22 '26 03:03

user962206


1 Answers

Using a proxy is usually not necessary for small local application web services. It depends mostly on your server load (number of clients, frequency of requests), and on the network area where your services are accessed : back-office server-to-server, front-office LAN, WAN or on the whole internet).

The REST webservices are mostly online resources, identified in a unique way by an URL, and generally served in a classic HTTP way. From the client side, he does not know if the data he gets is static, dynamic or cached. He simply gets the data as if it's static.

On large scale applications, with the increase of clients, resources and web services requests, you need technical components to handle problematics like user balancing, usage tracking of your web services as your application evolves. You'll also want to deliver the best performance you can to the clients. This can be achieved efficiently with a proxy solution.

Advantages of NOT using a proxy:

  • Simplicity

Advantages of using a proxy-based solution:

  • Rewrite URLs from a single centralized entry point (instead of setting it heterogeneously on each server/app/ws configuration).
  • Track the usage of your webservices (globally)
  • Enhance performance capabilities (caching, balancing to dedicated servers)
  • Managing API versions (switching gobally /myAPI from /myAPI-V1 to /myAPI-V2 easily done, and go back fingers in the nose)
  • Modifying some API calls on-the-fly (compatibility between versions, do preliminary input data validation, or add technical information to calls).
  • Manage webservices security globally (control IPs, quota per user, etc).

Hope this answers your question.

Edit (in answer to comment)

The proxy can act as a cache. For frequently asked resources (REST services), it can serve the same response to several users. Your service will be called juste once, even if there is 100 requests on this resource.

But this depend on how your services are really used, so you need to track requests to know if caching is helpful or not in your case.

  • How many users do you have ?
  • How many web services ?
  • Whar kind of data/resources are served ?
  • How fast are your services (individually) ?
  • What is the network performance ? (LAN? WAN? Internet? Mobile?)
  • How many servers and applications serve your users ?
  • Do you encounter any network load problems ?

A proxy cannot "accelerate" your existing services, but it can enhance the way you serve the resources to your clients.

Do not use a proxy if you do not know if you need it. You must know what is your actual system architecture and what are the weaknesses and bottlenecks.

like image 123
Stephane Lallemagne Avatar answered Mar 25 '26 01:03

Stephane Lallemagne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!