You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Didn't find any docs about the running model of envoy wasm. Does a plugin just like a single thread redis server, that we don't need to take care of the data race, or do we should protect the data by lock?
For example: I want to implement a http plugin that if url matches some regex, add coresponding pre-configured value to its request header, so that VirtualService can leverage this header to do some traffic splitting.
Because regex matching consumes too much cpu time, I want to cache the result
// fast pathifhead_val, ok:=self.cache.get(url); ok {
// set request headerreturnContinue
}
// slow pathhead_val, ok:=self.do_regexp_match(url)
ifok {
self.cache.set(url, head_val)
}
// set request headerreturnContinue
I don't know if I should add a rwlock to protect the cache object?
typepluginContextstruct {
cacheThreadSafeMap[string,string] // does this map need to be thread safe? Or a builtin map is ok?
}
func (ctx*pluginContext) NewHttpContext(contextIDuint32) types.HttpContext {
return&myRegexMatchPlugin{cache: ctx.cache}
}
The text was updated successfully, but these errors were encountered:
no since Proxy-Wasm is single-threaded (and Wasm is in a general single thread). Please search the GitHub repo before asking questions on the issues #368
Didn't find any docs about the running model of envoy wasm. Does a plugin just like a single thread redis server, that we don't need to take care of the data race, or do we should protect the data by lock?
For example: I want to implement a http plugin that if url matches some regex, add coresponding pre-configured value to its request header, so that VirtualService can leverage this header to do some traffic splitting.
Because regex matching consumes too much cpu time, I want to cache the result
I don't know if I should add a rwlock to protect the cache object?
The text was updated successfully, but these errors were encountered: