Title: Get request and response sizes without using content buffering Post by: GeirBerg on June 25, 2015, 10:02:36 AM Hi!
Is it possible to get the request and response sizes (content length) from a DataRouter without having to set ManualRead to false (using buffering)? It does not matter when the information becomes available (before/during/after the request) as it is only used for logging and statistics. If this is NOT possible, in general what impact on performance, delay, server resources, etc. can we expect from leaving ManualRead set to false? Most calls will have quite small amounts of data in both directions (1-2 KB?), however a small percentage of the calls will have data in the order of multiple megabytes. Unfortunately we cannot simply *test and measure* this scenario as the production servers can potentially have hundreds of simultanious users. Regards. Title: Re: Get request and response sizes without using content buffering Post by: D.Tkalcec (RTC) on June 25, 2015, 10:45:15 AM You have access to the complete Request and Response headers currently available to the DataRouter component (including the ContentLength value, when receiving content body) in all DataRouter events throught the Sender parameter (using Request and Response properties).
All events with the Sender parameter as TRtcDataServer give you access to the complete Request headers received from the Clients, while events with the Sender parameter as TRtcDataClient give you access to the complete Response headers received from the Server, even before a single byte of the content body was recevied, so there is no need for content buffering if you are only interested in Request and Response header information (like the ContentLength value, for example). You would only need to enable content buffering if you had to modify the content body before it is being forwarded to the other side, because the ContentLength value is defined in the HTTP header (Request and Response), so it has to be set before sending the actual content. Best Regards, Danijel Tkalcec Title: Re: Get request and response sizes without using content buffering Post by: GeirBerg on June 25, 2015, 11:47:54 AM Thank you very much! :)
It works just fine now. I somehow managed to confuse myself with the details of how TRtcRouterContentBody and related events works. Simply checking the 'Content-Length' header didn't occur to me. Time for a coffee break, I think. Regards. |