Skip to content

Commit

Permalink
sqliterepo/cache: prevents threads starvation
Browse files Browse the repository at this point in the history
Get rid of the old model with a fixed-number of GCond used to bucketize
all the DB accesses.

Now one couple of GCond (normal, prio) is associated to each cache item,
and this is better since the lifetime of each item is the whole
execution.

In addition, the notion of maximum bases used has been reviewed to allow
slight changes on the effective maximum. Now we propose one "hard"
maximum used to allocate structures at init time, and one "soft" maximum
that can be freely changed between (0,hard].
  • Loading branch information
jfsmig committed Oct 18, 2016
1 parent 3bb8477 commit c34414a
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 168 deletions.
4 changes: 4 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ Used by `gcc`

| Macro | Default | Description |
| ----- | ------- | ----------- |
| SQLX_HEAVYLOAD_ALERT | TRUE | Should the server fail a request for the purpose of a heavy duty on a base |
| SQLX_HEAVYLOAD_FAIL | FALSE | Should the server alert (if not failing) for a heavy duty on a base |
| SQLX_MAX_WAITING | 16 | How many waiters on a cache slot necessary to consider the duty is heavy |
| SQLX_MAX_BASES | 8192 | Default max number of bases, if not overriden at runtime. |
| SQLX_SYNC_DEFAULT_ZK_TIMEOUT | 8765 | |
| SQLX_DIR_SCHEMAS | NULL | Default directory used to gather applicative schema of SQLX bases. NULL by default, meaning that no directory is set, so that there is no attempt to load a schema. |
| SQLX_ADMIN_PREFIX_SYS | "sys." | Prefix used for keys used in admin table of sqlite bases |
Expand Down
1 change: 1 addition & 0 deletions core/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ enum {
CODE_NOT_IMPLEMENTED = 501,
CODE_PROXY_ERROR = 502, // unknown error when contacting an other service
CODE_UNAVAILABLE = 503,
CODE_EXCESSIVE_LOAD = 504,

CODE_PLATFORM_ERROR = 600,
};
Expand Down
Loading

0 comments on commit c34414a

Please sign in to comment.