- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在围绕 cgroups
和 tc
时遇到问题。
我正在尝试为特定进程增加延迟。下面的代码不起作用。但我不知道哪里出了问题(甚至不知道什么是对的)。
# Set up net_cls to make
modprobe cls_cgroup
mount -t cgroup -o net_cls none /sys/fs/cgroup/net_cls
# Create a new CGroup called 'high-latency'
mkdir /sys/fs/cgroup/high-latency
# All packets originating from this CG have their packers
# marked as class 1:11 / 0x1_0011
echo 0x100011 > /sys/fs/cgroup/high-latency/net_cls.classid
# Delete old rules, just in case
tc qdisc del dev eth0 root
# New root
tc qdisc add dev eth0 handle 1: root htb
# Class for filtered packets 1:11 == 0x10011
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 100Mbps
# Apply delay to class 1:11
tc qdisc add dev eth0 parent 1:11 handle 10: netem delay 1000ms
# Don't understand this line at all! Why does tc need to know
# about 'cgroup', when net_cls is already putting them in class 1:11
tc filter add dev eth0 parent 1:11 protocol ip prio 10 handle 1: cgroup
# Add my process to the cgroup
echo 1234 > /sys/fs/cgroup/high-latency/tasks
另一个有趣的事情是,在运行这个之后,cat /sys/fs/cgroup/high-latency/tasks
打印一大堆进程(全部?),包括 pid 1。
知道我做错了什么,更重要的是 - 在尝试使用 tc 和 cgroups 时我可以使用哪些调试工具?
最佳答案
不能一起工作。您可以通过 cgroup
对数据包进行分类,然后需要通过 netfilter
将流量重定向到 netem 接口(interface)。
关于linux - cgroups 和 tc/netem : Not sure how to make them work together,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23732292/
我有一个正在执行大量删除操作的存储过程。数十万条记录。它不会从应用程序运行,但我仍然担心,我的一个客户不小心运行了它(由于他们的“好奇心”,我早些时候遇到了问题):D 是的。有备份和类似的东西,但我在
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
在我的一些表格上,我有一个额外的弹出确认“你确定吗?”在它真正破坏记录之前。我正在使用 Rails 4 和 simple_form。这是一个例子。 我有一个名为 Promotions 的模型和另一个名
论文重新审视了深度神经网络中的不确定性估计技术,并整合了一套技术以增强其可靠性。论文的研究表明,多种技术(包括模型正则化、分类器改造和优化策略)的综合应用显着提高了图像分类任务中不确定性预测的准
我有以下代码: class ServiceA { def save(Object object) { if (somethingBadComesBack) { th
我已将 [空购物车] 按钮添加到我的 Woocommerce 购物车页面。 太棒了。 我想添加一个弹出窗口来询问用户“您确定吗?” 万一他们购物了两个小时,然后错误地点击了这个按钮。 我认为这是自定义
最近在这方面来来回回。尝试使用 Putty 将 SSH 隧道从我机器上的本地主机端口附加到可访问 Internet 的 SSH 服务器另一端的内部端口。 Putty 不会检查端口是否可用。在打开 Pu
Shiny 的新手在这里。 我正在尝试编写一个 R Shiny 脚本,我想要做的一件事是生成给定日期和不同地区的给定广告商的广告浏览次数的直方图。 我的表有以下列(带有示例数据): Date I
我有一些影响生产服务器的 Jenkins 工作。最好有一个“你确定要这样做吗?”当用户运行这些作业之一时的对话框。我还没有找到一个插件。有没有人尝试过这样做? 最佳答案 你可以添加一个“你确定吗?”构
早安开发者, 我正在尝试在 powershell 中创建删除功能。我想要这样的东西: function deleteEnv(){ $result = [System.Windows.For
我有以下代码: JsonElement deviceConfig = null; JsonObject status = getRestAPI().Connectivity().get
#include #include #include #include #include "battleshipgrid.h" using namespace std; battleshipg
最近我在处理一个未初始化的变量时遇到了很多麻烦。 在Java中,变量的默认值为null,因此如果使用未初始化的变量,很可能会抛出异常。如果我理解,在 C++ 中,变量是用内存中的任何数据初始化的。这意
我这辈子都想不起来如何绕过恼人的提示 你确定吗? Y/N 删除文件时。 我好像记得是这样的: del C:\Test && ECHO Y 最佳答案 使用del/F/Q强制删除只读文件(/F)和目录,不
我有一个带有 submit_tag 的表单。 我既要设置内容值,又要有一个确认意图的 js 弹出窗口。 我试过了 the suggestion in this answer和 what the doc
我曾经问过一个问题here如果 Windows DLL 由 Microsoft 签名。我意识到它们是,一个好 friend 告诉我 SigCheck实用程序可以提供有关文件签名的信息;但还有一个问题:
我经常发现,当程序员或分配任务的人不能真正理解解决方案的工作方式时,他们会随机添加一些东西,直到它起作用为止。 示例: 重新绘制由于某种原因未按程序员希望绘制的窗口: Invalidate(); Re
我有一个 Rails 应用程序,并且想要模拟 onunload 效果以在离开更改之前进行提示。环顾四周时,我发现了Are You Sure? . 我已经在表单上实现了它,它可以在页面刷新时工作,但它不
目前,我的取消按钮有这个 jQuery 代码 $('#cancel').click(function () { $('#edit').show(); $('#savechanges,
我希望使用 MediaIOUploadBase 向 CLI 提供上传进度,并且我可以看到有一个名为 MediaUploadProgress 的类,但它不是上传的包装器,因此我假设它是从事件上传中以某种
我是一名优秀的程序员,十分优秀!