Home Help Center

How to implement bandwidth control with ICE?

OrNotOrNot Member Bin.LiOrganization: GE HealthcareProject: Enterprise solution
hi, there,
IcePatch is a very powerful template for us to implement a c/s download application. And now I want to have further control in server side , that is, a bandwith control. For example, I want to control every client's network flow.
However I have no ideas so far how to do it and doubt if it is possible with Ice since ICE is a middleware .
If impssible, does it mean I have to give up ICE in this circumstance and look for other solutions?




  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    It depends exactly what you want. You can throttle bandwidth over the overall ethernet link through either the kernel or router configuration. You might want to look at http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html

    It may be possible with this to throttle on a per-IP basis also.

    If you want to do this in code on a per-client basis then you would need to modify Ice. I think it can be done as follows.

    Look at src/Ice/TcpTransceiver.cpp. Then look at the TcpTransceiver::write method. Notice that this already handles different packet sizes under Win32. The basic idea would be to mod the implementation to use a packet size initially based on the bandwidth limitation. Record the timestamp before you call write. After write look at the timestamp. If its not time to send more data, then sleep for a suitable time period, and then continue on. read can work in the same way.

    Of course, to really fully integrate this into Ice it would require much more work since you'd need to setup suitable configuration and then modify the core to send the bandwidth throttling to the transceiver.
  • OrNotOrNot Member Bin.LiOrganization: GE HealthcareProject: Enterprise solution
    Thank you so much.
Sign In or Register to comment.