Almost what we need :) definitely worth using, I was thinking about some inter-worker communication protocol which could then also be used across multiple instances / farms for better (auto)scaling.
Well I've made an inter worker communication system and it works quite well.
small example logging with 4 workers taking a peer up:
2015/03/01 23:20:26 [error] 2748#3304: [lua] iworkcomproto.lua:15: timer activation for worker: 2748, context: ngx.timer
2015/03/01 23:20:31 [error] 2912#2888: [lua] iworkcomproto.lua:15: timer activation for worker: 2912, context: ngx.timer
2015/03/01 23:20:31 [error] 3568#3776: [lua] iworkcomproto.lua:15: timer activation for worker: 3568, context: ngx.timer
2015/03/01 23:20:31 [error] 3568#3776: [lua] iworkcomproto.lua:25: message for worker: 3568: #2912#luaupstfoo,2,1, context: ngx.timer
2015/03/01 23:20:31 [error] 3768#1028: [lua] iworkcomproto.lua:15: timer activation for worker: 3768, context: ngx.timer
2015/03/01 23:20:31 [error] 3768#1028: [lua] iworkcomproto.lua:25: message for worker: 3768: #3568#2912#luaupstfoo,2,1, context: ngx.timer
2015/03/01 23:20:31 [error] 2748#3304: [lua] iworkcomproto.lua:15: timer activation for worker: 2748, context: ngx.timer
2015/03/01 23:20:31 [error] 2748#3304: [lua] iworkcomproto.lua:25: message for worker: 2748: #3768#3568#2912#luaupstfoo,2,1, context: ngx.timer
2015/03/01 23:20:36 [error] 2912#2888: [lua] iworkcomproto.lua:15: timer activation for worker: 2912, context: ngx.timer
2015/03/01 23:20:36 [error] 3568#3776: [lua] iworkcomproto.lua:15: timer activation for worker: 3568, context: ngx.timer
2015/03/01 23:20:36 [error] 3768#1028: [lua] iworkcomproto.lua:15: timer activation for worker: 3768, context: ngx.timer
2015/03/01 23:20:37 [error] 2748#3304: [lua] iworkcomproto.lua:15: timer activation for worker: 2748, context: ngx.timer
2015/03/01 23:20:41 [error] 2912#2888: [lua] iworkcomproto.lua:15: timer activation for worker: 2912, context: ngx.timer
2015/03/01 23:20:41 [error] 3568#3776: [lua] iworkcomproto.lua:15: timer activation for worker: 3568, context: ngx.timer
Each worker deals with a message and adds itself so it doesn't process the message again.
but I am missing a feature, I'd like to do
QResult = ngx.shared.iworkcomproto:get("IWCP_MSG_PD%")
but obviously it doesn't work, other then going through all the keys '' is there a way to search with a wildcard?
The reason is that I need to add a random value to the key value (IWCP_MSG_PD_qwerty12345) to make the message unique to sort of create a Que of messages, going through all the keys all the time is not really efficient, unless someone else has a better idea how to Que such messages and pull them back out :)