- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
How to pass LongRunning flag specifically to Task.Run()?强调将任务创建标志添加到较新的 API 中可能有点麻烦,尤其是使用 async
图案。
我发现这篇文章声称这不是一个好主意 async
无论如何也不应该使用:http://blog.i3arnon.com/2015/07/02/task-run-long-running/
我的理解是,这个标志在实践中会导致 TPL 启动一个专用线程而不是给线程池带来压力,但特别是如果我的应用程序不涉及大量并行任务,这真的很重要吗?如果我的预期并行度小于默认线程池大小(无论是什么),我是否可以安全地省略该标志 - 最糟糕的情况是线程池可能会在几百毫秒内缺乏线程?
最佳答案
LongRunning
调用 Task.Factory.StartNew
时默认省略标志方法不通过 TaskCreationOptions
参数,因此您可以安全地假设 省略它是安全的 .实际上省略它比包含它更安全,因为这个标志旨在作为一种性能优化技术,而不是作为日常用品。
In general, don't use it unless you find that you really need it. You'd typically only use
LongRunning
if you found through performance testing that not using it was causing long delays in the processing of other work. (citation)
ThreadPool
经常因为它的线程被滥用(在等待 I/O 操作完成时被阻塞)而被饿死,而不是装饰你的所有
Task
s 与
LongRunning
标志,一个更简单、更有效的解决方法可能是增加
ThreadPool
的最小数量。线程与方法
ThreadPool.SetMinThreads
在您的应用程序初始化期间。例如:
ThreadPool.SetMinThreads(workerThreads: 100, completionPortThreads: 5);
LongRunning
在您的代码中随处标记。
关于c# - 在任务上指定 LongRunning 有多重要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60146857/
什么是事物 事务是一种机制、一个操作序列,包含了一组数据库操作命令,并且把所有的命令作为一个整体一起向系统提交或撤销操作请求,即这组数据库命令要么都执行,要么都不执行。 事务是一个不可分割的工.作逻辑
什么是范式? 简言之就是,数据库设计对数据的存储性能,还有开发人员对数据的操作都有莫大的关系。所以建立科学的,规范的数据库是需要满足一些规范来优化数据数据存储方式。在关系型数据库中这些规范就可以称为范
什么是事物 事务是一种机制、一个操作序列,包含了一组数据库操作命令,并且把所有的命令作为一个整体一起向系统提交或撤销操作请求,即这组数据库命令要么都执行,要么都不执行。 事务是一个不可分割的工.作逻辑
什么是范式? 简言之就是,数据库设计对数据的存储性能,还有开发人员对数据的操作都有莫大的关系。所以建立科学的,规范的数据库是需要满足一些规范来优化数据数据存储方式。在关系型数据库中这些规范就可以称为范
我正在尝试修改网站的布局,但有时网站会使用 !important,有没有办法覆盖它?我似乎无法弄清楚如何在页面的 css 文件之后加载 css 内容脚本。 最佳答案 !important CSS 规则
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 9 年前。 我写了一些 html,并在第三方网站中注入(inject)了一些 css 样
好的,我在这里安装了一个 wordpress 主题(www.sullivansuccesscoaching.com/home ...我们需要/home,因为仍然有一个 index.html 隐藏了 w
我已经为我的 Wordpress 模板创建了一个覆盖原始 CSS 的自定义样式表。但是,在我的日历页面上,原始 CSS 具有使用 !important 声明设置的每个表格单元格的高度: td {hei
这个问题在这里已经有了答案: How to document deconstructed parameters with JsDoc (1 个回答) 关闭 5 年前。 我正在努力寻找对文档 ES6
我的网站使用 bootstrap 4 和我制作的 css 文件。 在这个 css 文件的底部,我放置了一些媒体查询: @media (max-width: 575px) { .address .c
可以将 background-position X 设置为 0 带有标志 !important 和背景位置 Y 不带 !important? 例如: background-position-x: 0
我只想在焦点状态下去掉下拉列表中的轮廓。看这张图 我尝试使用 !important 覆盖 Bootstrap ,但根本不起作用。只是检查开发工具,突然看到这个。 Bootstrap 也使用 !impo
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 1 年前。
发生了什么事?:我的 jQuery Accordion 的动画坏了。在关闭上一个选项卡之前短时间单击下一个选项卡后,它会显示之前打开的选项卡。动画也不滑动。 CSS:来自this answer /*
如何使用 javascript 或 CSS 覆盖样式“color: red”?我想让它成为“2px”而不是“1px”边框。 Lorem... 我无法向“div”添加类、id。这不
这个问题在这里已经有了答案: How to override !important? (12 个答案) 关闭 5 年前。
滚动有问题不想显示其内容,如果我这样做 #callCenter { position: fixed; z-index: 2411 !important; display: bl
序言 1、MySQL表操作(创建表,查询表结构,更改表字段等), 2、MySQL的数据类型(CHAR、VARCHAR、BLOB,等), 本节比较重要,对数据表数据进行查询操作,其中可能大
如何将!important添加到客户端包GWT中的gwt-image: 我有这个: @sprite .superButton{ gwt-image : 'superButton'; backg
请帮助我..我想验证表单并使用 ajax 发送。 验证没有 ''onsubmit="return validateForm(this);"'' 工作。 但是当表单正确时,它的发送表单(页面刷新..)请
我是一名优秀的程序员,十分优秀!