java 如何实现负载均衡调用接口
黄舟
黄舟 2017-04-18 09:04:15
0
3
511

我需要调客户一个接口(webservice),客户把这个接口分A、B两台服务器部署了。 但他们又没有配置nginx来做负载均衡,我们也不能用nginx来给他加一个,只能自己用程序来实现。 请问怎么破这个问题?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
阿神

Implement load balancing yourself, I think you may need this. Load balancing algorithm

巴扎黑

How do you want to break it? Haven't you already thought about "implementing it yourself with a program"?

nginx不能用,是因为nginxUsually used as a reverse proxy. The so-called reverse proxy needs to be placed on the client server side (this is not possible in your case)

So you need to write your own code to implement a forward proxy server. On your side, your applications will send requests to your "proxy server", and then the proxy server will forward the requests to the client. As for api映射是hard code还是配置文件,亦或是jmxIsn’t this all just at your fingertips?

So your question is, I am too lazy to write one by handproxy server. Is there any ready-made one?

Added:

Actually nginx can also be done, and it should be simpler.

  1. Build a server by yourself

  2. Use this servernginx

  3. Configure forwarding rules for this nginx

  4. Let all your application requests be sent to the server above

  5. This new server will help you forward requests to the client’s various webservices

  6. Each webservice of the customer returns data to this new server

  7. New server returns data to your application

It’s pretty good, ^^

Peter_Zhu

You can only do the load yourself

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template