首页 \ 问答 \ 在Azure Fabric可靠参与者之间共享EventHub(Sharing EventHub between Azure Fabric reliable actors)

在Azure Fabric可靠参与者之间共享EventHub(Sharing EventHub between Azure Fabric reliable actors)

我有一个应用程序,可以将设备从物理世界映射到Azure Fabric中的 Reliable Actors 。 每次我收到来自设备的消息时,我都会将消息推送到事件中心。

我现在正在做的是为每条消息创建/使用/关闭EventHubClient对象。

这是非常低效的(大约需要1500ms),但它解决了我在过去将EventHubClient保存在内存中的问题。 当我有很多设备时,底层虚拟机可能会很快耗尽网络连接。

我正在考虑创建一个新的actor,负责将数据推送到EventHub(通过保持EventHubClient存活)。 由于Reliable Actors的基于转向的并发模型,我不确定这是一个好主意。 如果我有10 000台设备在同一时间推送数据,他们的每个参与者都会阻止将消息推送给将消息推送到EventHub的新角色。

这种情况下推荐的方法是什么? 谢谢,


I'm having an application where I map devices from the physical world to Reliable Actors in Azure Fabric. Each time I receive a message from a device, I want to push a message to an event hub.

What I'm doing right now is creating/using/closing the EventHubClient object for each message.

This is very inefficient (it takes about 1500ms) but it solves an issue I had in the past where I was keeping the EventHubClient in memory. When I have a lot of devices, the underlying virtual machine can quickly run out of network connections.

I'm thinking about creating a new actor that would be responsible for pushing data to the EventHub (by keeping the EventHubClient alive). Because of the turned based concurrency model of Reliable Actors, I'm not sure it's a good idea. If I get 10 000 devices pushing data "at the same time", each of their actors will block to push the message to the new actor that pushes message to the EventHub.

What is the recommended approach for this scenario ? Thanks,


原文:https://stackoverflow.com/questions/41505494
更新时间:2023-07-16 19:07

最满意答案

您的PHP代码似乎混淆了列名称date (显示在您的WHERE子句中)和post_date (它显示为您的fetch_assoc()子句产生的列名。您实际上同时拥有datepost_date列吗?

此外,看起来你的WHERE子句中的不等式可能是一个接一个。

如果你想从今天起最近一年,那就是

WHERE date >= CURDATE() - INTERVAL 1 YEAR

在那之前的那一年,它是

WHERE date >= CURDATE() - INTERVAL 2 YEAR
  AND date <  CURDATE() - INTERVAL 1 YEAR

如果它是您想要的当前日历年 ,请使用此日历年 。 它有点复杂,因为它允许在date列上使用索引。 DATE_FORMAT()表达式将当前日期(例如2015-03-10)更改为2015-01-01。

WHERE date >= DATE_FORMAT(CURDATE(), '%Y-01-01')

类似地,在此之前的日历年是这样完成的。

WHERE date >= DATE_FORMAT(CURDATE(), '%Y-01-01') - INTERVAL 1 YEAR
  AND date <  DATE_FORMAT(CURDATE(), '%Y-01-01')

Your php code seems to be confusing the column names date (which appears in your WHERE clause) and post_date (which appears as a column name resulting from your fetch_assoc() clause. Do you actually have both date and post_date columns?

Also, it looks like the inequalities in your WHERE clauses might be off-by-one.

If you want to get the most recent year from today, it's

WHERE date >= CURDATE() - INTERVAL 1 YEAR

For the year prior to that, it's

WHERE date >= CURDATE() - INTERVAL 2 YEAR
  AND date <  CURDATE() - INTERVAL 1 YEAR

If it's the present calendar year you want, use this. It's a little complicated because it allows the use of an index on the date column. The DATE_FORMAT() expression turns the present date, e.g. 2015-03-10, into 2015-01-01.

WHERE date >= DATE_FORMAT(CURDATE(), '%Y-01-01')

Similarly, the calendar year prior to the present one is done like this.

WHERE date >= DATE_FORMAT(CURDATE(), '%Y-01-01') - INTERVAL 1 YEAR
  AND date <  DATE_FORMAT(CURDATE(), '%Y-01-01')

相关问答

更多
  • 我将你提供的示例数据加倍,以显示它如何与多个userIds配合使用。 看到它在这里工作,在一个sqlfiddle。 select userid, groupnum, min(ping) as start_date, max(ping) as end_date, max(ping) - min(ping) as duration from ( select *, @groupnum := if(@prevUser != userId, @groupnum + 1, @groupnum), @groupnum ...
  • 尝试这个: SELECT a.invoiceno, a.invoicerefno, a.invoicedate, c.companyname, a.grandtotal, a.twempname, itemdescription, quantity FROM twsql_twalldata.t_invoicedet a INNER JOIN twsql_twalldata.t_salesinv_items b ...
  • 如果你删除了所有的表并重新创建它们,可能就不准确了......但是那又是什么时候该数据库最后被重新创建了...... SELECT MIN(CREATE_TIME) FROM information_schema.tables WHERE table_schema = DATABASE() Might not be exact if you have dropped all the tables and created them again... but then again that is when ...
  • 您的PHP代码似乎混淆了列名称date (显示在您的WHERE子句中)和post_date (它显示为您的fetch_assoc()子句产生的列名。您实际上同时拥有date和post_date列吗? 此外,看起来你的WHERE子句中的不等式可能是一个接一个。 如果你想从今天起最近一年,那就是 WHERE date >= CURDATE() - INTERVAL 1 YEAR 在那之前的那一年,它是 WHERE date >= CURDATE() - INTERVAL 2 YEAR AND date < ...
  • 这是你要找的...... SELECT `accounts`.* FROM `accounts` INNER JOIN `packages` ON `packages`.`id` = `accounts`.`package` WHERE DATEDIFF(DATE_ADD(`accounts`.`register_date`,INTERVAL `packages`.`experience` DAY) ,NOW()) = 10 Here is what you are looking for ... ...
  • mysql查询可以是以下行 - select * from sample where dateCol >= DATE(DATE_SUB(NOW(),INTERVAL XX DAY)) and dateCol <= DATE(DATE_ADD(NOW(),INTERVAL YY DAY)) The mysql query can be something on the below lines - select * from sample where dateC ...
  • SELECT name,mydate FROM persondb WHERE mydate BETWEEN DATE_SUB(NOW(),INTERVAL 5 DAY) AND NOW(); 您的查询在将来显示日期的原因是因为您检查mydate是否晚于或等于5天前。 日期2011-08-31 14:50:37满足此要求。 您可以使用BETWEEN检查它是否在现在和5天之间的范围内。 SELECT name,mydate FROM persondb WHERE mydate BETWEEN DATE_SUB ...
  • SELECT * FROM premium WHERE start_date < DATE_SUB(CURDATE(),INTERVAL HOUR(start_date) DAY) ORDER BY RAND() LIMIT 1 或者,如果您的列名为time do SELECT * FROM premium WHERE start_date < DATE_SUB(CURDATE(),INTERVAL HOUR(`time`) DAY) ORDER BY RAND() LIMIT 1 不 ...
  • 据我所知,没有原生解决方案。 假设您正在使用shell并且具有如下集合: > db.foo.find({}, {_id: 0}) { "date" : ISODate("2012-10-06T10:28:10.595Z") } { "date" : ISODate("2013-10-01T10:28:14.115Z") } { "date" : ISODate("2013-10-16T10:28:19.522Z") } { "date" : ISODate("2016-11-04T11:23:00.391Z ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)