在同一台服务器上设置redis及其客户端应用程序(Setting up redis and its client applications on same server [closed])
我正在查看设置配置平台/服务的选项,该配置平台/服务将为所有客户服务/应用程序提供配置。 要求是应在专用服务器上设置。
我正在探索redis是否可以作为支持复杂键值配置的可能选项之一。 如果要在与消费者不同的服务器上设置redis,那么GET会涉及一些网络延迟(我不太担心SET,因为它们将比GET少得多)。 我应该在客户端计算机上设置另一个缓存层(例如EhCache或其他)以避免机器到机器的网络延迟吗? 在这种情况下,需要处理缓存同步和失效。 此外,我已经读过redis支持复制,但是客户端服务机器上的从服务器(它是主服务器的确切副本)将占用大量内存,因为redis主要使用RAM来存储所有数据。 而且,它们都可以竞争CPU /资源。
注意:客户端服务/应用程序当前部署在Amazon ec2媒体实例上。 类似的也可以用于redis。
如果这个架构有任何不错的选择,请告诉我,否则这一点都不好。 提前致谢。
I'm going through the options for setting up a configuration platform/service which is going to serve configuration to all the consumer client services/applications. The requirement is that this should be set up on a dedicated server.
I was exploring if redis could be one of the possible options to use for supporting complex key-value configuration. If redis is to be set up on a different server than that of the consumer, there will be some network latency involved with the GETs (I'm not that much worried about SETs as they will be very fewer than GETs). Should I be setting up another caching layer on the client machines (e.g. EhCache or something else) to avoid machine-to-machine network latency? Cache sync and invalidation needs to be handled in that case. Also, I've read that redis supports replication, but a slave server (which is the exact copy of the master) on the client service machine would then occupy good amount of memory as redis predominantly uses RAM to store all the data. Also, both of them can then compete for CPU/resources.
Note: Client services/applications are currently deployed on Amazon ec2 medium instance. And a similar one might be used for redis as well.
Please let me know if there are any good alternatives with this architecture or this isn't good at all. Thanks in advance.
原文:https://stackoverflow.com/questions/13986434
最满意答案
null-coalescing操作符是你的朋友。
(order.Promo.PercentOff ?? 0)
The null-coalescing operator is your friend.
(order.Promo.PercentOff ?? 0)
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
检查LINQ查询中的Var是否为空,并返回比x早的值(Checking if Var from LINQ query is Null and returning values older than x)[2019-11-08]
Philippe已经谈到了事物的序列方面 - 尽管你甚至不需要对Any()的调用。 毕竟,如果没有变化,循环就不会做任何事情。 你真的想在每次迭代中提交更改吗? 最后这样做可能会更有意义。 另外,您可以使用DateTime.AddMinutes使初始“10分钟前”变得更简单,如果您仅通过Where子句进行筛选,则会使用点符号。 在所有这些更改(并使变量名称更有用)之后,代码如下所示: DateTime tenMinutesAgo = DateTime.Now.AddMinutes(-10); var en ... -
您可以简单地使用Where过滤。 var Beatles = (from a in Artists join g in Groups on a.GroupId equals g.Id where a.GroupId == 1 select a.ArtistName).ToList(); 我无法弄清楚你为什么要申请加入,在这种情况下它完全是多余的。 var Beatles = Artists.Where(x => x.GroupId == 1).Select(x => x.Artis ...
-
使用All linq方法: var result = Comparison.All(item => item.Value == null) 基本上它的作用是迭代集合中的所有项目并检查每个项目的谓词。 如果一个不匹配 - 结果为假 Using linq method of All: var result = Comparison.All(item => item.Value == null) Basically what it does is to iterate all items of a colle ...
-
在比较之前检查属性为null或为空,这是我所知道的唯一方法 if (!string.IsNullOrEmpty(searchString)) { Infos = Infos.Where( x => (!String.IsNullOrEmpty(x.FirstName) && x.FirstName.ToLowerInvariant().Contains(searchString)) || (! ...
-
Linq查询,如何检查空值并使用值0代替空值?(Linq query, how to check for a null value and use the value 0 in place of a null?)[2023-12-07]
null-coalescing操作符是你的朋友。 (order.Promo.PercentOff ?? 0) The null-coalescing operator is your friend. (order.Promo.PercentOff ?? 0) -
如果Linq查询为空或匹配特定值,则查询该字段(Linq query to pick up field if it is null or matches specific value)[2022-03-31]
不能只使用两个查询? ListsimilarZips; if (zipCode.ZipCode != null) { similarZips = (from z in _db.ZipCodeTerritory where z.StateCode.Equals(zipCode.StateCode) && z.ChannelCode.Equals(zipCode.ChannelCode) ... -
LINQ查询检查为空(LINQ query checks for null)[2023-04-09]
在C#中, &&操作符是短路的,所以如果第一个条件返回false,第二个条件根本不会被执行。 来自MSDN: 条件AND运算符(&&)执行其bool操作数的逻辑与,但必要时仅评估其第二个操作数。 || 运算符的行为方式与此类似,不同之处在于,如果第一个参数返回true,则不计算其第二个参数。 尽管如此,我不认为这是完整的故事。 我的文章的其余部分包括以下几点: 您可以使用DataContext.Log记录SQL语句。 无论您编写它的方式如何,您的查询都不应该生成错误。 LINQ到对象和LINQ to SQL ... -
c#linq如何在同一列中检查我需要为空的空值(c# linq how to check for null values in the same column that i need to be not null)[2023-07-13]
如果字段SentOn可以为null ,则必须返回DateTime? 而不是DateTime 。 尝试: var finalResults = (from r in results.AsEnumerable() where r.Field("SentOn") != null && DateTime.Now.Subtract(r.Field ("SentOn")).Minutes > ...