Is there a way in CakePHP to create a "lean" controller method?
I'm planning to call a controller method multiple times per minute for each user via a simple ajax call. The method just returns a simple value out of memcache (current active users on site). I would like to know if there is a way to create a lean method without any overhead as this method will be called around 10.000 times per minute.
I tried implementing this with a NodeJS-broadcast which worked to some degree but wasn't entirely reliable.
By this question you imply that the controller is slow. Have you done a benchmark before? If no do it now.
Controllers in Cake3 are already pretty slim, if you need even less use a dispatcher filter and send the response before the controller is even instantiated. But you'll have to do your users authentication and authorization manually then, no AuthComponent present here.
The main bottleneck will be your infrastructure and not the script in any case. So I would focus on a proper load balancing setup as well to distribute the load to many instances.
I don't know what you really want to do but this sounds more like a job for a websocket implementation that can be done with Node or Ratchet for php as well.