-
Notifications
You must be signed in to change notification settings - Fork 129
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
Question: Thread safety requirements & pitfalls for storr backends with caching = "worker" #1094
Comments
First of all, I suggest verify possible sources of slowness using concrete profiling data. When @billdenney and @adamkski sent me their profiling data for #1089 and #1086, we actually pinpointed and eliminated the bottlenecks. As I describe at https://github.com/ropensci/drake/blob/master/.github/ISSUE_TEMPLATE/bottleneck.md#benchmarks, it would be great if you would post zip files of profiling data to this issue thread. The code that goes along with it would be super helpful as well.
For worker caching, the cache should fully expect concurrent writes of different targets. When I tested an RSQLite-powered Related: There may be a use case for a monolithic database-style
|
Also, I recommend checking with @richfitz about the current state of database |
My other question was going to be about the best way to measure this bottleneck in my workflow, thank you for this!
I'm sure such a use-case exists, although my proposed implementation would probably just be a
That's an interesting comment, I wonder how that would relate to my workplace's file-system.
It's actually by design that my system has as many targets as it does (Targets are split into n indexed partitions that have homogenous keyspaces on the highest level foreign key, which is intended to manage the memory requirements of the huger targets, while preserving downstream linking, and allowing Presently each input df is split into 100 partitions, but as the workflow grows I'm finding that the cost of submitting this on HPC is significant, so I think I need to revise this approach, the problem is that I'm working with a test extract of data, and I don't know what size of data to expect from the full extract but it will be significantly more massive (But I digress) |
Yeah, maybe a
The conceptual layout of tasks does not necessarily need to match the collection of targets. A single target can run a bunch of tasks and return a list of results. |
FYI: I expect #1095 to speed up things for you. |
@mstr3336, did I answer your questions? Do you have more? |
You did, I would start diverging off-topic if I got into them for this thread. I have questions about the following:
Also, I did install from the latest dev version, (
I haven't filed it in its own issue because I can't say for sure that the upgrade in drake is the culprit, given there's other factors I'm troubleshooting, and I don't have a reprex or sessioninfo to provide you, though my instincts tell me this is more likely to be related to the new cache optimizations rather than clustermq troubles. For the time being I rolled drake back to |
Hmm... sorry you're getting an error. The SQL stuff doesn't sound like a Glad you saw a speedup. I do not think FYI, I just released a profiling package that should make it easier to collaborate on performance issues: https://github.com/wlandau/proffer. |
I am closing this general issue. Let's follow up on more specific issues as they arise. |
Sure - I do note that I have a large amount of raw data, and I used static branching to produce a very big plan (It might be in the order of thousands of targets). You have mentioned that that design mightn't be optimal. Also, our HPC nodes aren't particularly fast.
Thanks! That should be very helpful! |
Prework
drake
's code of conduct.drake-r-package
tag. (If you anticipate extended follow-up and discussion, you are already in the right place!)Context
As mentioned in #1025 , my workplace's HPC array uses LustreFS, which is said to perform poorly under intensive read/write operations on small files (Under 20MB, I think?).
This makes the RDS backend for
storr
a poor choice.This forces me to use the
SQLite
&caching = "master"
strategy, but I do notice that I only seem to be able to have ~ 10 or so jobs queued/running on the PBS (The nominal limit of our system is 200 jobs in queue/running), and I wonder if that's because themaster
process is a bottleneck (The CPU's on individual compute nodes are not particular fast on our HPC, there's just lots of them).(The other bottleneck is that often the queue time for a transient worker exceeds the actual compute time it uses by orders of magnitude, I plan to change from
future
toclustermq
when I have the chance because I do expect that persistent workers will execute much faster)Question
I understand why it might be that the
SQLite
backend isn't threadsafe, as it's stored as a monolithic db file, that probably wouldn't hold up to concurrent modification/access of its resources, which mandates the "master" caching strategy.My question, however is:
storr
backend intended for use bydrake
actually need to be?I ask for the following reasons
Thread-safety is a requirement when we anticipate that multiple workers require access to a shared resource, and that modification of the resource may occur at the same time as access of the resource.
Unless thread-safety is ensured, this could lead to undefined behaviour, as with the classic RC of
Scenario
RC
RC
In the execution of a
drake
workflow, a given resource (ie, a target) is only written to once,after this, workers building dependent targets will read from this target.
Multiple workers may be doing so at once, but this is still threadsafe as long as none are attempting to modify the parent target.
I'm interesting in implementing a very simple
storr
backend that (perhaps) simply writes targets to disk (as a single .rds), and makes no guarantees of thread-safety for concurrent IO of a given target, but can assure thread-safety in the context ofdrake::make
execution, as targets are only written to once, and only read from after they've been written.I'm interested to hear what anyone makes of this idea, whether there's a reason it could damage performance, and whether there's some concurrent file IO risk (intrinsic to filesystem access) I'm neglecting.
The text was updated successfully, but these errors were encountered: