我在 golang reddit 看到這段話不太懂解釋給我
'''
What kinds of tasks or problems in your backend or distributed systems projects require you to actively use concurrency?
Batch jobs mostly; sending lots of requests to some queue, a scraper or similar.
The vast majority of communication in distributed systems are either:
Blocking external requests; you need the response to continue
Or queues: you don't care about the result, just make sure it happens some time in the future
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
How frequently do you find yourself leveraging concurrency primitives (e.g., goroutines, channels, mutexes)?
Very rarely.
The main concurrency is already taken care off; requests are handled in goroutines automatically and for the majority of requests this is enough.
In addition, we use utilities built on top of concurrency limits for the following reasons:
A mature system should take care of context.Context
You need concurrency limits to stop things running out of control
You want proper error handling.
All these three things are actually quite hard to do correctly, so we built a utility and almost all our concurrency / batch-like jobs are handled like this:
Parallel[T any](ctx context.Context, maxParallel int, values []T, fn func(v T) error, n int) error
That our main use case; running a bunch of things in parallel.
That leaves in-memory queues which are dangerous simply because any long-running process on a web server is bound to go wrong sometime. It's much better to use some queueing solution in a distributed system; which again eliminates the need for a good portion of Go concurrency controls.
What would you say are the most important concurrency skills to master for production systems?
Honestly? Know the basics of Goroutines, channels and mutexes. That's it.
Think it's more important to learn concurrency patterns for distributed systems (queues, topics, DLQ, etc).
And lastly, if you work as a distributed systems/backend engineer what do you typically do on a day-to-day basis?
Figure out what the business and my colleagues need. Then ask AI to fix it for me.
'''