I am talking in terms of parsing http request by using

http.ReadRequest method which only accept bufio.Reader 
(https://golang.org/pkg/net/http/#ReadRequest)

On Friday, May 4, 2018 at 8:04:22 PM UTC+5:30, Ian Lance Taylor wrote:
>
> On Fri, May 4, 2018 at 5:20 AM, Ankit Gupta <[email protected] 
> <javascript:>> wrote: 
> > 
> > I recently wrote a reverse proxy in Go - 
> > https://github.com/gptankit/serviceq which does load balancing and 
> queues 
> > failed requests (to dipatch later). 
> > When I compared perf with nginx, I noticed 15-20 ms higher response 
> times. 
> > So, I timed each function, and got to know that the code spends most 
> time in 
> > 3 places - 
> > 
> > Read from tcp conn 
> > Save in a buffer 
> > Write to tcp conn 
> > 
> > 'Save' is necessary addition as I need to re-run the requests. For 
> 'Read' 
> > and 'Write', I use bufio - 
> > 
> > Read: 
> >         reader := bufio.NewReader(*httpConn.tcpConn) 
> >         req, err := http.ReadRequest(reader) 
> > 
> > Write: 
> >         writer := bufio.NewWriter(*httpConn.tcpConn) 
> > 
> > Why does Go impose me to read from bufio.Reader and not directly from 
> > io.Reader? I understand the implication for bigger data but for few 
> bytes, 
> > managing a buffer seems like an overhead. 
>
> I'm sorry, I don't understand the question.  Go does not in general 
> require you to use a bufio.Reader.  Where is that requirement coming 
> from? 
>
>
> > I am using Go 1.6. 
>
> That is pretty old now. 
>
> Ian 
>

-- 
*::DISCLAIMER::

----------------------------------------------------------------------------------------------------------------------------------------------------


The contents of this e-mail and any attachments are confidential and 
intended for the named recipient(s) only.E-mail transmission is not 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted,lost, destroyed, arrive late or incomplete, or may contain 
viruses in transmission. The e mail and its contents(with or without 
referred errors) shall therefore not attach any liability on the originator 
or redBus.com. Views or opinions, if any, presented in this email are 
solely those of the author and may not necessarily reflect the views or 
opinions of redBus.com. Any form of reproduction, dissemination, copying, 
disclosure, modification,distribution and / or publication of this message 
without the prior written consent of authorized representative of redbus. 
<http://redbus.in/>com is strictly prohibited. If you have received this 
email in error please delete it and notify the sender immediately.Before 
opening any email and/or attachments, please check them for viruses and 
other defects.*

-- 
*::DISCLAIMER::

----------------------------------------------------------------------------------------------------------------------------------------------------


The contents of this e-mail and any attachments are confidential and 
intended for the named recipient(s) only.E-mail transmission is not 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted,lost, destroyed, arrive late or incomplete, or may contain 
viruses in transmission. The e mail and its contents(with or without 
referred errors) shall therefore not attach any liability on the originator 
or redBus.com. Views or opinions, if any, presented in this email are 
solely those of the author and may not necessarily reflect the views or 
opinions of redBus.com. Any form of reproduction, dissemination, copying, 
disclosure, modification,distribution and / or publication of this message 
without the prior written consent of authorized representative of redbus. 
<http://redbus.in/>com is strictly prohibited. If you have received this 
email in error please delete it and notify the sender immediately.Before 
opening any email and/or attachments, please check them for viruses and 
other defects.*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to