iodine 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of iodine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/iodine/defer.c +4 -2
- data/ext/iodine/iodine_core.c +4 -3
- data/ext/iodine/spnlock.inc +2 -4
- data/lib/iodine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6014039fdfb709a1f2c91e87cef8970d7351dbaa
|
4
|
+
data.tar.gz: cee4a5ccc2fb5e581ea0bd4f69f6adc5a4e2da82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93509b3ccf5c567e3c53d3be96b140f3dfa029d58785fb176204e4fc6657509f0c2fb3f01b8593f303731f40a784223da715765d7e7a3aeaa7f1c126ecbfa347
|
7
|
+
data.tar.gz: 1383a991e247bd4c3fb23f89625484b2ee246b175bc7a49fbeb7ada68e6ec101a5ddb8412fc3387251549d77812cbd4bf9b5157d37d7b2f5d021f5b09f304d91
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,11 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
10
10
|
|
11
11
|
#### Change log v.0.3.1
|
12
12
|
|
13
|
+
**Update**:Follow `facil.io`'s update for healthier thread throttling and energy consumption.
|
14
|
+
***
|
15
|
+
|
16
|
+
#### Change log v.0.3.1
|
17
|
+
|
13
18
|
**Fix**: Fixed a minor issue with the logging of responses where the size of the response is unknown (streamed).
|
14
19
|
|
15
20
|
**Gem Specification update**: We updated the gem specification to allow for Rack 1.x users and to update the gem description.
|
data/ext/iodine/defer.c
CHANGED
@@ -23,7 +23,7 @@ Compile time settings
|
|
23
23
|
#define DEFER_QUEUE_BUFFER 4096
|
24
24
|
#endif
|
25
25
|
#ifndef DEFER_THROTTLE
|
26
|
-
#define DEFER_THROTTLE
|
26
|
+
#define DEFER_THROTTLE 16384UL
|
27
27
|
#endif
|
28
28
|
|
29
29
|
/* *****************************************************************************
|
@@ -180,7 +180,9 @@ struct defer_pool {
|
|
180
180
|
|
181
181
|
static void *defer_worker_thread(void *pool) {
|
182
182
|
signal(SIGPIPE, SIG_IGN);
|
183
|
-
size_t throttle = (((pool_pt)pool)->count
|
183
|
+
size_t throttle = (((pool_pt)pool)->count) * DEFER_THROTTLE;
|
184
|
+
if (!throttle || throttle > 524288UL)
|
185
|
+
throttle = 524288UL;
|
184
186
|
do {
|
185
187
|
throttle_thread(throttle);
|
186
188
|
defer_perform();
|
data/ext/iodine/iodine_core.c
CHANGED
@@ -609,17 +609,18 @@ static VALUE iodine_count(VALUE self) {
|
|
609
609
|
/* *****************************************************************************
|
610
610
|
Running the server
|
611
611
|
*/
|
612
|
+
#include "spnlock.inc"
|
612
613
|
#include <pthread.h>
|
613
|
-
|
614
614
|
static volatile int sock_io_thread = 0;
|
615
615
|
static pthread_t sock_io_pthread;
|
616
616
|
|
617
617
|
static void *iodine_io_thread(void *arg) {
|
618
618
|
(void)arg;
|
619
|
-
static const struct timespec tm = {.tv_nsec =
|
619
|
+
// static const struct timespec tm = {.tv_nsec = 524288UL};
|
620
620
|
while (sock_io_thread) {
|
621
621
|
sock_flush_all();
|
622
|
-
|
622
|
+
throttle_thread(524288UL);
|
623
|
+
// nanosleep(&tm, NULL);
|
623
624
|
}
|
624
625
|
return NULL;
|
625
626
|
}
|
data/ext/iodine/spnlock.inc
CHANGED
@@ -11,9 +11,6 @@ spinlock / sync for tasks
|
|
11
11
|
#endif /* __unix__ */
|
12
12
|
#include <stdlib.h>
|
13
13
|
|
14
|
-
/** Sets the value for the thread throttling feature, where available. */
|
15
|
-
// static size_t SPN_LOCK_THROTTLE = 8388608UL;
|
16
|
-
|
17
14
|
/* manage the way threads "wait" for the lock to release */
|
18
15
|
#if defined(__unix__) || defined(__APPLE__) || defined(__linux__)
|
19
16
|
/* nanosleep seems to be the most effective and efficient reschedule */
|
@@ -24,7 +21,8 @@ spinlock / sync for tasks
|
|
24
21
|
}
|
25
22
|
#define throttle_thread(micosec) \
|
26
23
|
{ \
|
27
|
-
const struct timespec tm = {.tv_nsec = (micosec)
|
24
|
+
const struct timespec tm = {.tv_nsec = (micosec), \
|
25
|
+
.tv_sec = /* (micosec >> 20)*/ 1}; \
|
28
26
|
nanosleep(&tm, NULL); \
|
29
27
|
}
|
30
28
|
#else /* no effective rescheduling, just spin... */
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|