Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-24 Thread Zihan Yang
y, but in this way, we only need read lock if we operate on the item itself instead of the list. I am not an expert in caching and golang, so please correct me if I misunderstand anything. Jesper Louis Andersen 于2019年7月24日周三 下午10:44写道: > On Wed, Jul 24, 2019 at 7:16 AM Zihan Yang > w

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-24 Thread Zihan Yang
t access to the P struct and G Id > easily. > > On Jul 24, 2019, at 7:41 AM, Zihan Yang > wrote: > > As I said before, my use case is a little complicated, let me explain it. > > I am trying to add more cache inside a project called [gVisor][1], which > is an open sourc

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-24 Thread Zihan Yang
e lru list. 在 2019年7月24日星期三 UTC+8下午7:52:35,Robert Engels写道: > > The OS file cache is almost certainly going to better than rolling your > own. You can probably still find the studies that the Lucene team did in > this regard. > > On Jul 24, 2019, at 12:16 AM, Zihan Yang >

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
e > right thing to do *unless* profiling tells you so. > > On Jul 23, 2019, at 7:49 PM, Zihan Yang > wrote: > > Thanks for the example code, this is a possible solution. But my goroutine > is not long-running. More specifically, each goroutine performs some IO, > then ret

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
github.com/robaho/go-concurrency-test > > On Jul 23, 2019, at 9:55 PM, Zihan Yang > wrote: > > CGO sounds good, but I remember CGO invocation is not cheap? (not sure > where I saw it). > > Would you provide a reference to "Chaney id project"? I don't find

[go-nuts] Re: P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
.. If I use the segment-based solution, I have to either reclaim this big chunk as whole, or not to reclaim it at all. Neither way is friendly. 在 2019年7月24日星期三 UTC+8上午4:44:07,Pat Farrell写道: > > > > On Tuesday, July 23, 2019 at 1:22:09 PM UTC-4, Zihan Yang wrote: >> >> I a

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
ussions on golang-dev about named Go routines which might be > a workaround, but so far the TLS (or PLS) discussion has been a non > starter. > > On Jul 23, 2019, at 12:10 PM, Zihan Yang > wrote: > > I am trying to implement an LRU cache. Several global lru lists could be > ac

Re: [go-nuts] P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
> } > > > Unfortunately this does not seem to be in any intro guides, which pushes > people to complicated workarounds. > > On Tue, Jul 23, 2019 at 10:22 AM Zihan Yang > wrote: > >> I am trying to implement an LRU cache. Several global lru lists could be >> a

[go-nuts] P-local/M-local storage for goroutines?

2019-07-23 Thread Zihan Yang
I am trying to implement an LRU cache. Several global lru lists could be accessed concurrently by multiple goroutines, which could be a disaster in a machine with 24 or more cores. Therefore, it would be great if I can add the item to P-local storage and flush the batched item into the lru l