amnuts / opcache-gui

A clean, effective and responsive interface for Zend OPcache
1.23k stars 198 forks source link

multi-server support #70

Closed p5ych0 closed 2 years ago

p5ych0 commented 3 years ago

I'm running several php-fpm servers for balancing purposes. could you suggest how to setup the GUI as a separate service and then check each server separately, or have a quick overview for all at once?

amnuts commented 3 years ago

Interesting question @p5ych0 and not one I've thought of before now. Off the top of my head, you could use the Amnuts\Opcache\Service class with an endpoint over the top of it which has an endpoint that returns the contents of the compileState method call. You'd then have to change the main GUI script so that instead of using $opcache = (new Service($options))->handle();` you'd go to each of your services, get the results and amalgamate them for output.

Of course, that has a bunch of issue to resolve such as what if there are different directives? How would you know what server the results came from? How would you invalidate anything in the cache (because you'd need to know which server)? ... and so on.

I think a lot of that could probably be resolved by also including an id or url of the server you've got those results from and then putting that into the results. Combine anything that is the same across all servers (like functions or possibly directives), but for the file list have a list built up of on which servers that file is found. Then you could work out something in the frontend to invalidate and filter based on the server values(which would require extra endpoints on the web services to do such things).

I think it'll require a bit of a rejig of things, but doesn't feel like it'd be too much or a re-write.

p5ych0 commented 3 years ago

I think it'll require a bit of a rejig of things, but doesn't feel like it'd be too much or a re-write.

I think drop-down selection of a single server to check would be sufficient

amnuts commented 3 years ago

Yeah, that would work, too. I was going for a more integrated approach, I guess, but it's your setup so do what best works for you. 😄