Problem resolved. Application was allocating a new http.Client for every 
remote call made, and since the handshake ultimately comes down to CGO 
calls, I was accumulating memory that was not managed by Go's GC.

On Tuesday, March 14, 2017 at 8:21:58 PM UTC-4, Nathan Morley wrote:
>
> Hello,
>
> So I've written a small service in my free time that essentially pulls 
> data from a RESTful API at a high rate, and store it in a database. While 
> there is no rate limiting in place and I'm free to hit it as hard as I like 
> with as many connections I need, I only have 5 workers going at a time that 
> actively hit the API.
>
> I started noticing that the application quickly allocates/uses a fair bit 
> of memory than I would have suspected for such a simple use case. so I set 
> up profiling via the pprof tool to see what is going on. I found no real 
> issue with my own code, but it looks like my http.Client is the primary 
> offender for me. Particularly, the handshake and in parsing the x509 
> certificate.
>
> While it is probably more than reasonable to see this, given what is 
> involved, I'm wondering if there might be something I can do to bring down 
> the application's overhead?
>
> I also may be reading in to this too hard, as well. But my end goal is to 
> have this application out of my development environment and on my server, 
> which is already somewhat limited in resources.
>
> I can provide the pprof graph if it would.
>
> TL;DR
>
> I wrote a small application that hits a RESTful API really hard, but 
> doesn't do much else. I'm noticing a lot of memory being used by the TLS 
> handshake and in parsing the x509 certificate.
>
> Does anyone have suggestions on how I might improve this, or thoughts on 
> what I might be doing wrong here?
>
> For the record, this is on a Windows PC, and I have not tested for this on 
> my server, which runs on Linux.
>
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to