Skip to content

net/http: client is slow #4507

Closed
Closed
@gopherbot

Description

@gopherbot

by hk.yuhe:

I have a web API written in Golang.
The API fetch data from redis(http://redis.io/) using
Go-redis(https://github.com/alphazero/Go-Redis),do some iter computation and return.

When I run benchmark with http_load,the result is not that good.
The result is as follows:

[yugaohe@localhost test]$ http_load -p 100 -s 60 t.txt
459810 fetches, 100 max parallel, 7.44892e+07 bytes, in 60.0004 seconds
162 mean bytes/connection
7663.45 fetches/sec, 1.24148e+06 bytes/sec
msecs/connect: 0.523986 mean, 3000.81 max, 0.069 min
msecs/first-response: 12.3115 mean, 1041.64 max, 0.51 min
HTTP response codes:
  code 200 -- 459810

I do some profile work following this
blog(http://blog.golang.org/2011/06/profiling-go-programs.html)
And find it is SCANBLOCK that stucks!

I make several images about this:

http://yugaohe.sinaapp.com/rtdeAnalysis.html
http://yugaohe.sinaapp.com/rtdeAnalysis2.html

Does Golang really do bad in Garbage Collection?
And how can I optimize my golang program?


Which compiler are you using (5g, 6g, 8g, gccgo)?

I use 6g

Which operating system are you using?

cat /proc/version
Linux version 2.6.18-274.17.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2
20080704 (Red Hat 4.1.2-51)) #1 SMP Tue Jan 10 17:25:58 EST 2012

Which version are you using?  (run 'go version')

go version go1.0.3

Attachments:

  1. pprof.png (23967 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions