Title: TRtcLoadBalancer and dynamically adding and removing servers Post by: CDR19 on November 24, 2011, 06:43:16 PM I have a Webservice which I like to run on multiple servers as the load on one server is getting to heavy.
To communicate with the webservice i'd like to put a loadbalancer before it which decides which server should answer the requests. The requests are stateless, so sessions don't need to be taken into account. The webservice sends an udp message when it's up running and ready to receive requests. It also sends a message when it's going down. While running and processing requests it also sends a heartbeat message every x seconds. In looking into TRtcLoadBalancer and can find the AddServer function. But there is no equivalent RemoveServer function.
Regards Yvo Nelemans Title: Re: TRtcLoadBalancer and dynamically adding and removing servers Post by: D.Tkalcec (RTC) on November 24, 2011, 06:55:41 PM You can't add or remove Servers when a Load Balancer is running if you are using the "TRtcLoadBalancer" component (as shown in RtcLoadBalancer2 and RtcLoadBalancer3 Demos). You will need to STOP the Load Balancer first. The same rule applies to making any kind of changes to Server configuration or changing component properties. This is important because the same set of components is used from all connections from all threads, so you have to make sure the components aren't currently in use by a background thread when making changes, adding or removing components.
Best Regards, Danijel Tkalcec Title: Re: TRtcLoadBalancer and dynamically adding and removing servers Post by: CDR19 on November 24, 2011, 07:25:52 PM If it's not possible to dynamically added/remove servers. Is it possible to stop sending new request to a specific server?
This would also help to implement a scenario where 1/3 of the requests are send to one server and 2/3 of the request to another. Stopping the loadbalancer and restarting it is not an options for me. We're currently getting up to 30 requests per second which on average get answerd within 200 milliseconds. I'm guessing that stopping and starting the loadbalancer will cause requests to not be handled. Regards Yvo Nelemans Title: Re: TRtcLoadBalancer and dynamically adding and removing servers Post by: D.Tkalcec (RTC) on November 24, 2011, 07:28:12 PM If you need the abbility to add and remove Servers "on-the-fly", instead of using the "TRtcLoadBalancer" component (which has to be set-up in advance), you should use the "TRtcDataRouter" component as shown in the "RtcLoadBalancer" Project.
When using the "TRtcDataRouter" component, you will be maintaining your own list of TRtcDataRequest and TRtcHttpClient components for connecting to different Servers, which means that you will also have the abbility to update that list as needed and decide "on-the-fly" to which Server you want to send each request - when the request is ready. In that scenario, there is no need to set up all Servers in advance. Using the "TRtcDataRouter" component gives you direct control over the Load Balancer, but requires more manual coding. Best Regards, Danijel Tkalcec Title: Re: TRtcLoadBalancer and dynamically adding and removing servers Post by: CDR19 on November 24, 2011, 07:33:54 PM Thanks for the hint, I was looking in the wrong component for the functionality I require.
Regards Yvo Nelemans |