golang too many json unmarshal trigger gc frequency to many
253 views
Skip to first unread message
刘桂祥
unread,
Oct 26, 2016, 10:29:01 PM10/26/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
In my server many requests need to handle a loop to unmarshal json strings and I find gc is very frequency
Tamás Gulácsi
unread,
Oct 27, 2016, 1:06:03 PM10/27/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
If you can't avoid generating garbage, then at least try to reuse it! That's what sync.Pool is for (don't make the map, reuse one).
Can't you read the Redis reply by chunks?
Erik Dubbelboer
unread,
Oct 28, 2016, 1:36:20 AM10/28/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Try https://github.com/pquerna/ffjson to improve speed and reduce garbage generation. This in combination with sync.Pool will increase your throughput by A LOT.
Klaus Post
unread,
Oct 28, 2016, 4:49:42 AM10/28/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
On Friday, 28 October 2016 07:36:20 UTC+2, Erik Dubbelboer wrote:
Try https://github.com/pquerna/ffjson to improve speed and reduce garbage generation. This in combination with sync.Pool will increase your throughput by A LOT.