WuYunlong
d229162730
Make main thread killable so that it can be canceled at any time.
...
Refine comment of makeThreadKillable().
This commit can be backported to 5.0, only if we also backport cf8a6e3.
Co-authored-by: Oran Agra <oran@redislabs.com>
2020-09-21 12:10:19 +03:00
WuYunlong
cf8a6e3c7a
bio: fix doFastMemoryTest.
...
If one thread got SIGSEGV, function sigsegvHandler() would be triggered,
it would call bioKillThreads(). But call pthread_cancel() to cancel itself
would make it block. Also note that if SIGSEGV is caught by bio thread, it
should kill the main thread in order to give a positive report.
2020-09-16 14:15:02 +03:00
Muhammad Zahalqa
7589560731
Fix unidentical function declaration in bio.c. lazyfree.c: lazyfreeFreeSlotsMapFromBioThread ( #7228 )
2020-08-11 19:16:10 +08:00
zhenwei pi
2c853869bf
Support setcpuaffinity on linux/bsd
...
Currently, there are several types of threads/child processes of a
redis server. Sometimes we need deeply optimise the performance of
redis, so we would like to isolate threads/processes.
There were some discussion about cpu affinity cases in the issue:
https://github.com/antirez/redis/issues/2863
So implement cpu affinity setting by redis.conf in this patch, then
we can config server_cpulist/bio_cpulist/aof_rewrite_cpulist/
bgsave_cpulist by cpu list.
Examples of cpulist in redis.conf:
server_cpulist 0-7:2 means cpu affinity 0,2,4,6
bio_cpulist 1,3 means cpu affinity 1,3
aof_rewrite_cpulist 8-11 means cpu affinity 8,9,10,11
bgsave_cpulist 1,10-11 means cpu affinity 1,10,11
Test on linux/freebsd, both work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-05-02 21:19:47 +08:00
Dave-in-lafayette
986c517239
fix for crash during panic before all threads are up
...
If there's a panic before all threads have been started (say, if file descriptor 0 is closed at exec), the panic response will crash here again.
2020-04-20 16:38:06 -07:00
zhenwei pi
302db38055
Threaded IO: set thread name for redis-server
...
Set thread name for each thread of redis-server, this helps us to
monitor the utilization and optimise the performance.
And suggested-by Salvatore, implement this feature for multi
platforms. Currently support linux and bsd, ignore other OS.
An exmaple on Linux:
# top -d 5 -p `pidof redis-server ` -H
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3682671 root 20 0 227744 8248 3836 R 99.2 0.0 0:19.53 redis-server
3682677 root 20 0 227744 8248 3836 S 26.4 0.0 0:04.15 io_thd_3
3682675 root 20 0 227744 8248 3836 S 23.6 0.0 0:03.98 io_thd_1
3682676 root 20 0 227744 8248 3836 S 23.6 0.0 0:03.97 io_thd_2
3682672 root 20 0 227744 8248 3836 S 0.2 0.0 0:00.02 bio_close_file
3682673 root 20 0 227744 8248 3836 S 0.2 0.0 0:00.02 bio_aof_fsync
3682674 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 bio_lazy_free
3682678 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
3682682 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
3682683 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
3682684 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
3682685 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
3682687 root 20 0 227744 8248 3836 S 0.0 0.0 0:00.00 jemalloc_bg_thd
Another exmaple on FreeBSD-12.1:
PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND
5212 root 100 0 48M 7280K CPU2 2 0:26 99.52% redis-server{redis-server}
5212 root 38 0 48M 7280K umtxn 4 0:06 26.94% redis-server{io_thd_3}
5212 root 36 0 48M 7280K umtxn 6 0:06 26.84% redis-server{io_thd_1}
5212 root 39 0 48M 7280K umtxn 1 0:06 25.30% redis-server{io_thd_2}
5212 root 20 0 48M 7280K uwait 3 0:00 0.00% redis-server{redis-server}
5212 root 21 0 48M 7280K uwait 2 0:00 0.00% redis-server{bio_close_file}
5212 root 21 0 48M 7280K uwait 3 0:00 0.00% redis-server{bio_aof_fsync}
5212 root 21 0 48M 7280K uwait 0 0:00 0.00% redis-server{bio_lazy_free}
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-04-18 11:17:21 +08:00
antirez
7a7996b71f
Fix typo in design comment of bio.c.
2018-10-05 18:29:23 +02:00
youjiali1995
ac7b3ec9ca
bio: fix bioWaitStepOfType.
2018-09-05 16:51:13 +08:00
zhaozhao.zz
d7d0493065
rdb: incremental fsync when redis saves rdb
2018-03-16 00:44:50 +08:00
antirez
cf03e071ea
Lazyfree: ability to free whole DBs in background.
2015-10-01 13:02:26 +02:00
antirez
062f789407
Lazyfree: keep count of objects to free.
2015-10-01 13:02:25 +02:00
antirez
fbc46738f4
Threaded lazyfree WIP #1 .
2015-10-01 13:02:25 +02:00
antirez
9295b586b4
bio.c: new API bioWaitStepOfType().
2015-10-01 13:02:25 +02:00
antirez
3064487047
RDMF: more names updated.
2015-07-27 15:03:10 +02:00
antirez
c15cac0d77
RDMF: More consistent define names.
2015-07-27 14:37:58 +02:00
antirez
e2b858a580
RDMF: redisLog -> serverLog.
2015-07-26 15:17:43 +02:00
antirez
6a424b5e36
RDMF (Redis/Disque merge friendlyness) refactoring WIP 1.
2015-07-26 15:17:18 +02:00
antirez
7c82681825
Check bio.c job type at thread startup.
...
Another one just to avoid a warning. Slightly more defensive code
anyway.
2015-03-30 12:17:46 +02:00
guiquanz
df7a5b7157
Fixed many typos.
2013-01-19 10:59:44 +01:00
antirez
a68a4463f7
Make bio.c threads killable ASAP if needed.
...
We use this new bio.c feature in order to stop our I/O threads if there
is a memory test to do on crash. In this case we don't want anything
else than the main thread to run, otherwise the other threads may mess
with the heap and the memory test will report a false positive.
2012-11-22 10:12:11 +01:00
antirez
a32d1ddff6
BSD license added to every C source and header file.
2012-11-08 18:31:32 +01:00
antirez
b460c6596e
Mask SIGALRM everything but in the main thread.
...
This is required to ensure that the signal will be delivered to the main
thread when the watchdog timer expires.
2012-03-27 13:48:57 +02:00
antirez
0a551df576
Comment out things in bio.c that are currently not useful but that may be useful in the future.
2011-09-19 17:06:27 +02:00
antirez
918e80a29c
use aof_fsync wrapper instead of fsync(2) in bio.c
2011-09-16 15:53:01 +02:00
antirez
dc5a9e043c
REDIS_BIO_AOF_FSYNC implemented
2011-09-15 18:25:53 +02:00
antirez
8bf559aeca
fixed a problem in bioOlderJobType() when there are no jobs of the specified type. Now the function returns 0 when this happens.
2011-09-15 18:23:58 +02:00
antirez
689520b365
some more comment about bio.c design
2011-09-15 18:23:11 +02:00
antirez
fa636fbb51
Remove backgroud jobs from the queue only when the processing was completed, and not just started.
2011-09-15 18:21:27 +02:00
antirez
1b5ba28d72
Use a different thread for every different type of background job
2011-09-15 18:21:16 +02:00
antirez
5628b46d5d
Better comments for bioWaitPendingJobsLE
2011-09-15 18:21:02 +02:00
antirez
485db6ea68
Background I/O library enhanced so that the main thread can query for the number of pending jobs of the specified type.
2011-09-15 18:20:53 +02:00
antirez
22f1abd1f0
make bio_list static as well
2011-09-13 16:56:43 +02:00
antirez
a9f573488e
debug message removed
2011-09-13 16:53:33 +02:00
antirez
f8a6b4bd02
use pthread_cond_signal() to make sure the background thread will process the job.
2011-09-13 16:21:12 +02:00
antirez
9c24b5fb6b
typo fixed in bio.c
2011-09-13 16:19:37 +02:00
antirez
962cfce8b7
bio.c typos fixes to make it compile
2011-09-13 16:09:06 +02:00
antirez
0f68818d30
bio.o added to redis-server objects
2011-09-13 15:59:48 +02:00