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
support content.backing-module=none #4267
Comments
I'm not sure about making this is the default, since there is unexplained job throughput degradation in this mode. However it is not currently possible to even select this mode. Let's allow this issue to be closed once setting Extra credit: allow KVS checkpoints to be saved in memory after the KVS module is unloaded so that |
Possible idea, simply allow user to specify special sqlite file of |
Well that got me wondering how that would go. Here's a quick patch that would use Using
Compared to master (rss reached 745m)
diff --git a/src/modules/content-sqlite/content-sqlite.c b/src/modules/content-sqlite/content-sqlite.c
index 6d9ad61f4..5fb46b734 100644
--- a/src/modules/content-sqlite/content-sqlite.c
+++ b/src/modules/content-sqlite/content-sqlite.c
@@ -539,11 +539,18 @@ static json_t *pack_tstat (tstat_t *ts)
return o;
}
+static bool isafile (const char *path)
+{
+ if (!strcmp (path, ":memory:"))
+ return false;
+ return true;
+}
+
static unsigned long long get_file_size (const char *path)
{
struct stat sb;
- if (stat (path, &sb) < 0)
+ if (!isafile (path) || stat (path, &sb) < 0)
return 0;
return sb.st_size;
}
@@ -552,7 +559,7 @@ static unsigned long long get_fs_free (const char *path)
{
struct statvfs sb;
- if (statvfs (path, &sb) < 0)
+ if (!isafile (path) || statvfs (path, &sb) < 0)
return 0;
return sb.f_bsize * sb.f_bavail;
}
@@ -607,7 +614,7 @@ static int content_sqlite_opendb (struct content_sqlite *ctx, bool truncate)
char s[128];
int count;
- if (truncate)
+ if (truncate && isafile (ctx->dbfile))
(void)unlink (ctx->dbfile);
if (sqlite3_open_v2 (ctx->dbfile, &ctx->db, flags, NULL) != SQLITE_OK) {
@@ -764,29 +771,25 @@ static struct content_sqlite *content_sqlite_create (flux_t *h)
}
/* Prefer 'statedir' as the location for content.sqlite file, if set.
- * Otherwise use 'rundir', and enable pragmas that increase performance
- * but risk database corruption on a crash (since rundir is temporary
- * and the database is not being preserved after a crash anyway).
+ * Otherwise :memory: will be used.
*/
if (!(dbdir = flux_attr_get (h, "statedir"))) {
- dbdir = flux_attr_get (h, "rundir");
ctx->journal_mode = "OFF";
ctx->synchronous = "OFF";
+ if (asprintf (&ctx->dbfile, ":memory:") < 0)
+ goto error;
}
- if (!dbdir) {
- flux_log_error (h, "neither statedir nor rundir are set");
- goto error;
- }
- if (asprintf (&ctx->dbfile, "%s/content.sqlite", dbdir) < 0)
- goto error;
-
- /* If dbfile exists, we are restarting.
- * If existing dbfile does not have the right permissions, fail early.
- */
- if (access (ctx->dbfile, F_OK) == 0) {
- if (access (ctx->dbfile, R_OK | W_OK) < 0) {
- flux_log_error (h, "%s", ctx->dbfile);
+ else {
+ if (asprintf (&ctx->dbfile, "%s/content.sqlite", dbdir) < 0)
goto error;
+ /* If dbfile exists, we are restarting.
+ * If existing dbfile does not have the right permissions, fail early.
+ */
+ if (access (ctx->dbfile, F_OK) == 0) {
+ if (access (ctx->dbfile, R_OK | W_OK) < 0) {
+ flux_log_error (h, "%s", ctx->dbfile);
+ goto error;
+ }
}
}
|
well, I thought I was "pretty close" to finishing this up a few days ago, but kept on hitting hiccups. The latest hiccup appears to be somewhat bad, so I'm thinking I'm going to park this for now and come back to this as the issue no longer on our v0.42.0 milestones. https://github.com/chu11/flux-core/tree/save_issue4267_content_backing_module_none
For example, one potential path is in Edit: Another potential (similar) path may be when we unload the backing-module, so that backing store requests get lost. I believe there is nothing wrong with PR #4463 so I will leave that PR as is (although I may add a cleanup or two I found along the way) for inclusion. |
Problem: By default the content-sqlite is loaded as a backing module. A backing module is necessary for long term storage of data in system instances, but may not be necessary for shorter lived single user instances. The backing module can introduce performance issues for these instances. Solution: By default do not load content-sqlite. Update all tests that require a backing module to load content-sqlite specifically. Update systemd unit file to set content-sqlite as backing module by default. Fixes flux-framework#4267
Problem: By default the content-sqlite is loaded as a backing module. A backing module is necessary for long term storage of data in system instances, but may not be necessary for shorter lived single user instances. The backing module can introduce performance issues for these instances. Solution: By default do not load content-sqlite. Update all tests that require a backing module to load content-sqlite specifically. Update systemd unit file to set content-sqlite as backing module by default. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: By default, rc scripts always assume a content backing module will be loaded. There is no way to specify "no" backing module. Solution: Support "none" as a special input to not load a content backing module. Fixes flux-framework#4267
Problem: the default instance configuration loads
content-sqlite
but removes the database file when the instance terminates and locates the database file in/tmp
, which on many systems is a ram disk. If it's memory either way - are we just expending effort moving it around?Perhaps we could change rc1 to only load
content-sqlite
whenstatedir
is defined, and advise workflow/DAT users to useflux start -o,-Sstatedir=/a/persistent/directory
The text was updated successfully, but these errors were encountered: