Re: [twsocket] Bandwidth counter for MT HTTP Server--what's thefastestway?
Sounds good. Since there are 32 clients/thread Do not use a constant. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, October 28, 2006 6:44 PM Subject: Re: [twsocket] Bandwidth counter for MT HTTP Server--what's thefastestway? Here is an idea I have come up with: Since there are 32 clients/thread, in the client connection thread I will setup a non-protected variable. Then each of these thread instances will have a timer that will every 1 sec post the value to the main thread and then reset the variable. Then in the server listener thread, we would have to do the same thing once again: add up the posted values, record every sec and reset. So this would use ttimers. Would the handle of these timers collide with ICSV6 TWndHandler? And what do you think overall? Best Regards, SZ On 10/28/06, Francois PIETTE [EMAIL PROTECTED] wrote: I know the question seems obvious. One way would be creting a critical section protected variable in the server listener thread and add every packet sent and check and reset every second, right? But let's consider we have 1000 clients downloading. Each second the critical section would be acquired and released at least 2000 times! I believe it would create a bottlenect just for the sake of drawing a chart of bandwidth transferred! What other method would you suggest? Use InterlockedExchangeAdd API function. It is a hardware assisted API and is the fastest possible. Another solution is to count each client individually and do the sum only when needed. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- Fastream Technologies Software IQ: Innovation Quality www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Bandwidth counter for MT HTTP Server--what's thefastestway?
We also create one thread per CPU initially and load-balance among them so this should not be a big problem. One other issue I have, for a reverse proxy, there cannot be more than ~32000 connections, right? I am speaking about the no-cache situation where there must be unique ports for a server and a client socket per each user with 64k sockets max. Regards, SZ On 10/28/06, Francois PIETTE [EMAIL PROTECTED] wrote: Sounds good. Since there are 32 clients/thread Do not use a constant. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, October 28, 2006 6:44 PM Subject: Re: [twsocket] Bandwidth counter for MT HTTP Server--what's thefastestway? Here is an idea I have come up with: Since there are 32 clients/thread, in the client connection thread I will setup a non-protected variable. Then each of these thread instances will have a timer that will every 1 sec post the value to the main thread and then reset the variable. Then in the server listener thread, we would have to do the same thing once again: add up the posted values, record every sec and reset. So this would use ttimers. Would the handle of these timers collide with ICSV6 TWndHandler? And what do you think overall? Best Regards, SZ On 10/28/06, Francois PIETTE [EMAIL PROTECTED] wrote: I know the question seems obvious. One way would be creting a critical section protected variable in the server listener thread and add every packet sent and check and reset every second, right? But let's consider we have 1000 clients downloading. Each second the critical section would be acquired and released at least 2000 times! I believe it would create a bottlenect just for the sake of drawing a chart of bandwidth transferred! What other method would you suggest? Use InterlockedExchangeAdd API function. It is a hardware assisted API and is the fastest possible. Another solution is to count each client individually and do the sum only when needed. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- Fastream Technologies Software IQ: Innovation Quality www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- Fastream Technologies Software IQ: Innovation Quality www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Bandwidth counter for MT HTTP Server--what's thefastestway?
Hello, 32000 max, whenever you could theorically reach this limit (which is most usure because of Windows/Winsock/Network card drivers limitations), you could may be add an option to manage two network cards, one for managing incoming sessions, other to manage outgoing sessions. This way, Winsock should be able to handle 64000 cnx per network card. Considering the bandwidth question, instead of entering critical section thousand time per second, there is a more non-blocking way. Just create a timer that send some EVENT_TELL_ME_YOUR_COUNT to each thread (this trigger no critical section), then each thread send back an event to main app thread with the byte count as param, then just do the calculation. Regards. FT We also create one thread per CPU initially and load-balance among FT them so this should not be a big problem. FT One other issue I have, for a reverse proxy, there cannot be more than FT ~32000 connections, right? I am speaking about the no-cache situation FT where there must be unique ports for a server and a client socket per FT each user with 64k sockets max. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be