-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sr status is too expensive/slow #174
Comments
Is there a metric for the time that we are targeting which would be acceptable, for checking the status and getting the results ? |
This is another one of those design things... likely need to move some code into the config module/class, and that is hard. |
@benlapETS, I would set a target: it should take less than 5 seconds on a setup with 300 components. I think that is hard to do. |
I may be off track with this issue but as I see that both concept are involved, I can tell I am not a big fan of sr_config being the parent of sr_instances as it doesnt make sense conceptually. I think the way to show that is to ask the questions : Does sr_instances is a configuration? Or does sr_instances use configuration? I believe that the latter is more representative of the relationship between instance and configurations. With that being said the uses is better represented by an association than by a generalization (that would be is a relationship). see Class diagram wiki... |
To me, the class hierarchy makes perfect sense: a configuration is an abstract definition of what a process should do. sr_instance adds a layer of process management around the configuration, and the components that inherit from sr_instances are specialized processes. Yes sr_subscribe is an instance, and yes an instance is a configuration. There's nothing conceptually wrong with it as-is. but this conversation sounds like debating angels on pinheads. We could debate that forever, but it isn't fruitful. It makes more sense to look at the change in terms of what it would take to implement. while I understand the OO purity quest, this isn't a greenfield project. Rather than starting from a platonic ideal, we need to deal with the existing codebase. Making sr_instance not inherit from sr_config will mean re-writing the entire application: All settings are set in config, and inherited by instance, which is then inherited by all of the component main routines. As there are hundreds of settings and almost everything in the application involves applying or interpreting settings, it will change at least ... (guess) 70% of the lines of code. In addition, all plugins use the settings included so it will break every single plugin included in the code, and worse, those developed by users. There are thousands of them. It's a bad idea. So while changing the hierarchy may appeal to your sense of propriety (and it doesn't even do that for me), the practical thing to do is to keep the same hierarchy and move some methods around to keep it compatible. Changing inheritance structure of sr_config->sr_instance->components will cause massive codebase disruption, and It is extremely doubtful that it is worthwhile. |
what probably should be done... implement a second configuration parser that scans the hierarchy differently. it reads:
Then use the foreground process to work on the result of this fixed data set. a foreground process should be able to execute this in under a second. |
I've started a branch (issue174) with a partial implementation. for a flow_test config, it's about 6x faster for status. I think the difference should increase with the size of the config... only status implemented so far, stop is modelled, but the kill's are in comments for now. |
It's called sr2.py on the branch and is a standalone script. |
renamed to srp.py (parallel) so it is installed as srp. start, stop, sanity done now... |
last case to deal with is when configured number of instances changes... need to understand what has happenned and do the right thing in sanity. |
Dunno if worth doing right now, but ... I think @benlapETS was asking about this... could add pattern matching to the command line here to operate on subsets of the configurations. (start up all the configs that start with:
|
stopping for now... I think the core is there as a proof of concept. |
renamed things to encourage use of new one... srp is now sr (so the default normal thing) but keeping the old one around as sr1.py (either version 1 or sequential (1 thread) version.) had to add declare and setup, but will never add cleanup or remove... both are too dangerous. |
Method to get a sample config to test with:
now have a bunch of configs setup, with no traffic going by...
so status is faster... declare?:
declare and setup are slower... in the new version... which is parallel.
now with parallel version:
So it's maybe 3x or 4x faster for this small testing configuration. Advantage should increase with the size of the configuration. |
basically you pay a 2 second overhead cost on startup, and then the rest should be much faster as there is no more reading of configurations... |
so this implementation uses subprocess. It is now a standalone thing (not messed up with other classes, many levels deep.) so it could be re-formulated to use another API (multiprocess) if desired. Not convinced it is helpful, but at least now it is easy to experiment. |
handing to Benoit to look at adding filtering. |
the declare 1st implementation is probably dumb. We should probably do it over as a global op. |
once declare is done, we can do a really safe cleanup, because it will understand all the declarations of all the configurations as a single unit. |
merged the work-in-progress for now... it passes the flow check and there is some positive feedback. |
released in 2.19.09 |
psutil on linux is still disastrously slow... going to make a shortcut on linux to call ps. |
well Giampaolo's fix was simple and effective... 2nd simpler patch in-bound... |
sr status was implemented, because it was easy, by forking processes that then read all the configurations and then check the status... it should, in principle be possible to do this in a single process.
The text was updated successfully, but these errors were encountered: