Go routines consuming memory

108 views
Skip to first unread message

Nikhilesh Susarla

unread,
Jun 6, 2023, 10:58:36 PM6/6/23
to golang-nuts
I was going through a blog where they compare different language threads to see how much memory they consume for a million tasks. 


Do we have any benchmarking/report before that Go routines take more memory with more threads? 

I know we can't consider it to be ideal but any reasons that the memory spiked up? 
Is there any blog to read more about go routines and their memory consumptions? 

Thank you

Jim Idle

unread,
Jun 6, 2023, 11:29:08 PM6/6/23
to Nikhilesh Susarla, golang-nuts
This benchmark is worthless for all languages used. 
  • Each Go routine will be given a 2K stack.
  • Go routines are managed by Go, threads by the operating system.
  • C# uses a thread pool.  
  • There's a lot wrong with this article, not just with things being claimed about Go.
  • Benchmarking is not the trivial exercise that the author thinks it is.
  • Would you really write any system like this in any of the languages?
  • One would use idiomatic techniques in each of the systems for huge numbers of tasks.   
  • Etc. 

Personally, I don't think that it is worth addressing; others may feel it is worth it to counter the spread of accidental disinformation.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0af076cc-8b5d-491b-88f5-599dbd37c056n%40googlegroups.com.

Kurtis Rader

unread,
Jun 6, 2023, 11:38:32 PM6/6/23
to Jim Idle, Nikhilesh Susarla, golang-nuts
Thank you. I had the same reaction. I'm a grey beard who in the past specialized in benchmarking and performance tuning. Synthetic, micro, benchmarks of the type used in that blog post are borderline useless. Especially when comparing different languages. Even when used to measure a single metric such as memory consumed. I found it interesting that the author didn't document (AFAICT) how the memory consumption was measured. And the use of ChatGPT to create some of the examples caused an eye-roll so strong I was surprised it didn't physically hurt.



--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Jim Idle

unread,
Jun 6, 2023, 11:52:22 PM6/6/23
to Kurtis Rader, Nikhilesh Susarla, golang-nuts
Ha ha. Yes, I am similarly bearded grey.

I didn't think it was worth filling in after Etc. I almost stopped reading after ChatGPT on the basis that if you cannot write the simple driver code, you can neither verify that the driver is correct, nor have the understanding of the system needed to interpret the results. Measuring things is a whole different ball game. 

Bakul Shah

unread,
Jun 7, 2023, 12:37:39 AM6/7/23
to Nikhilesh Susarla, golang-nuts
You should read the comments following the article you referenced. In addition there is a long thread on hackernews that might be worth browsing:

But if you want a real insight into how concurrent programs behave, you are better off writing your own toy benchmarking programs that focus on various aspects of concurrency. Then you can modify them to measure such metrics for your specific applications.

Reply all
Reply to author
Forward
0 new messages