我们有 6 个具有 256GB RAM、24c/48T 的 kafka 代理,它们托管在 raid10 中配置的 20 个 1.8TB SAS 10K rpm 磁盘。
有两个火花流应用程序
有 21 个注入器实例以 6K 事件/秒的速率连续写入该主题。他们使用 librdkafka poroducer 来向 kafka 生成事件。
当流媒体应用程序醒来时,他们的第一份工作是阅读主题。一旦这样做,kafka 磁盘中的 %util 将在 30 秒到 60 秒内变为 90-100%,同时所有注入器实例都从它们的 kafka 生产者那里得到“队列已满”错误。这是生产者配置:
从该图中看不到,但是在 util% 高的时候,有一段时间写入为 0,我们假设在这些时间注入器的生产者的队列已满,因此抛出“队列已满”错误。
值得一提的是,我们在kafka机器中使用deadline IO调度器,它优先考虑读取操作。
关于如何释放写的压力,我们有几个想法:
目前我正在运行Ubuntu 16.04,Linux内核版本为4.16.我编写了一个虚拟程序,将其调度程序更改为SCHED_DEADLINE.但是当我尝试编译它时,它找不到SCHED_DEADLINE所需的结构和宏的定义.大多数代码段都是从这里获取的(第24页).以下是测试程序:
#define _GNU_SOURCE
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sched.h>
int main(int argc, char* argv[]) {
struct sched_attr attr;
attr.size = sizeof(attr);
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = 30000000;
attr.sched_period = 100000000;
attr.sched_deadline = attr.sched_period;
if (sched_setattr(gettid(), &attr, 0))
perror("sched_setattr()");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是编译的输出:
sched_deadline.c: In function ‘main’:
sched_deadline.c:11:20: error: storage size of ‘attr’ isn’t known
struct sched_attr attr;
^
sched_deadline.c:12:21: error: invalid application of ‘sizeof’ to incomplete type ‘struct attr’
attr.size = sizeof(struct attr); …Run Code Online (Sandbox Code Playgroud) 我想在C中实现DEADLINE调度策略.我知道该功能已经实现,因为Linux 3.14.10我使用的Ubuntu 14.04 Linux #### 3.17.0-031700-lowlatency #201410060605 SMP PREEMPT已经足够了.我用Eclipse开发程序(作为sudo启动).
我已经定义_GNU_SOURCE和包含sched.h,我仍然无法使用关键字SCHED_DEADLINE,来定义struct sched_attr或使用像这样的函数sched_getattr.
#define _GNU_SOURCE
#include <sched.h>
Run Code Online (Sandbox Code Playgroud)
我的/usr/include/文件夹中没有定义这些关键字和函数,但我已设法找到它们/usr/src/linux-headers-3.17.0-031700/include/.我试图在我的项目的构建选项中包含此文件夹,但它似乎生成链接错误.
我真的不习惯C开发(我原来是一个JS开发者)所以如果有人能解释我做错了什么以及如何解决这个问题,那将是非常好的.
内容 /usr/include/linux/sched.h
#ifndef _LINUX_SCHED_H
#define _LINUX_SCHED_H
/*
* cloning flags:
*/
#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ …Run Code Online (Sandbox Code Playgroud)