-
Notifications
You must be signed in to change notification settings - Fork 18
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
CPU load when monitoring many stations #20
Comments
Yeah, we started this as simple as possible to start out with just relying on everything that's already there, development time vs. CPU's doing some more stupid number crunching .. ;-)
Sounds great! 👍
I'd be curious whether this impacts the minimum realizable update time, i.e. whether you can go to a smaller plot update time with that? The plot is in a different thread, so probably not, I guess? But the stream to plot might be more up to date, I guess.. Actually, there's a lot more in there that's probably not needed, all the super-tedious checking of sub-sample alignment.. hardly necessary for just a simple kiosk plot. ;-) ..but again, as long as it works.. In any case, I think it would be great to have your modification in master. Care to do a PR? |
I cant really tell, since in reality I only use the data retrieval part from the seedlink_plotter for a different application that I'm working on. At a latter stage I'll probably want to include some plotting as well and will then probably have a peak at the plotting part to get started. That said I actually also have several threads running that are accessing the collected streams but as these always makes a deep copy of the stream object and then operates copy (as is done by the seedlink_plotter). As the copying part seems to be quite efficient, this does not seem to be problematic (neglecting here the load from the work performed by the thread which is a different issue)
I would be very happy to contribute to this very nice and useful project : ). However, I think there's still some work to be done before my suggested solution is decent/general enough, and I also have to read up on how to do a PR (presumably not that hard but...). |
Great, just let us know when you have something!
Let us know if you're struggling and need directions with that.. |
Hi
Potentially this is a minor problem but as I stumbled across it I figured that I might as well report it here.
Running the seedlink_plotter for many streams I noted that the CPU usage quickly increased to 100% on my machine. There may of course many reasons for this but focusing on the data retrieval part I note that merging newly retrieved traces to the Stream object seems to account for most of the load. Looking deeper into the merge method of the stream object I suspect that this is due to the fact that trace list is regenerated every time the the merge method is invoked. If the stream object contains only few traces and this is not done very often this is not a problem, however for an application as the seedlink_plotter were the method may be called several times per second, adding one trace at the time, and the Stream object may contain many traces this adds an unnecessary overhead.
In the long term run perhaps adding a method to the Stream object that merges (or adds) a single trace to the list of traces is the desired solution and perhaps this should have been brought up as an issue on obspy instead (I report here instead as for now the issue seems more application specific and knowing that you are involved in the obspy development perhaps the suggestion if found useful eventually make its way in there).
My current (simplistic) workaround to the issue is to rip the core of the _cleanup method (used by merge(-1)) from the Stream object and make sure that only the traces with the same trace.id as the trace to merge in (if any) are touched. This reduces the CPU load on my machine from 100% to 10-20%
More exactly I came up with the following method that I added to the SeedlinkUpdater object
The text was updated successfully, but these errors were encountered: