这样做虽然解决了数据争用问题,但是在并发性方面付出了更多的代价,因为在迭代期间锁住整个list会阻塞其他线程,使它们在很长一段时间内不能访问这个列表。
This addresses the data race, but has further costs for concurrency, since locking the entire list while iterating could block other threads from accessing the list for a long time.
如果数据请求容量整体较高,复制或分布数据可以潜在地降低容量争用。
If the request volume for the data is high overall, replicating or distributing the data potentially reduces contention.
为频繁访问的数据提供缓存可以节省时间或降低数据库的争用和总体请求容量。
Providing a cache for frequently-accessed data might time-shift or reduce contention and overall request volumes to the database.
应用推荐