在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
最满意答案
您的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 < 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 yourWHERE
clause) andpost_date
(which appears as a column name resulting from yourfetch_assoc()
clause. Do you actually have bothdate
andpost_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. TheDATE_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')
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
我将你提供的示例数据加倍,以显示它如何与多个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 ...
-
带有日期比较的mysql查询(mysql query with date comparison)[2021-07-16]
尝试这个: 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 ... -
MYSQL使用查询安装日期(MYSQL install date using query)[2023-07-24]
如果你删除了所有的表并重新创建它们,可能就不准确了......但是那又是什么时候该数据库最后被重新创建了...... 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 ... -
按日期查询mysql(Query mysql by date)[2024-01-16]
您的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 ...
-
mysql日期查询问题(Problem with mysql date query)[2022-12-07]
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 ... -
MySQL日期查询(MySQL date query)[2023-05-20]
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 ...