基于服务的架构不一定意味着分配?(services based architecture should not necessarily imply distribution?)
在我的工作场所(以及许多其他领域),人们非常重视围绕服务构建架构。 (我在电子商务初创公司工作)。 但是,我认为服务被隐含地视为分布式的。 我是第一个分配法则的信徒 - “不分发”。 所以,我认为我们不应该必然使架构复杂化。 它应该是一个可以发展的架构。 因此,解决问题的方法之一是创建定义良好的命名空间并围绕它构建代码,但通过java api保持通信。 (这使得监控要求低,可靠性/可用性问题低)。 通过将模块包装到Web服务中,可以轻松地将其演变为分布式体系结构,并且当规模要求启动时。 因此,问题是 - 将代码编写为单个应用程序并演变为分布式服务的缺点是什么,而不是直接跳入实现基于Web服务的体系结构? 我是否正确地假设服务应该暗示设计的基本原则(抽象,封装等),而不是通过网络分发?
In my workplace (and a lot of other areas), there is a lot of emphasis on building architecture around services. (I am working in an e-commerce startup). However, I think services are implicitly considered as distributed. I am a believer of the first law of distribution - "don't distribute". So, I believe that we should not un-necessarily complicate architecture. It should be an architecture which can evolve. So, one of the ways to approach the problem would be to create well defined namespaces and build code around it, but keep the communication via java api. (this keeps monitoring requirement low, and reliability/availability problems low). This can easily be evolved into a distributed architecture by wrapping modules into web service, as and when, the scale requirements kick-in. So, the question is - what are the cons of writing code as a single application and evolving into distributed services, rather than straight jumping into implementing web services based architecture? Am I right in assuming that services should imply the basic principles of design (abstraction, encapsulation etc), rather than distribution over network?
原文:https://stackoverflow.com/questions/7457160
满意答案
func (o *MongoOps) AddToBsonMapElement(lstMap map[string]interface{}, Operation string, key string, value interface{}) (result map[string]interface{}) { status, msg := EmptyStructCheck(o) if status == true { LogError(msg) panic(msg) } if Operation == "$addToSetEach" { if _, ok := lstMap["$addToSet"]; ok { childmap := lstMap["$addToSet"] subchildmap := childmap.(map[string]interface{}) var val map[string]interface{} val = make(map[string]interface{}) val["$each"] = value subchildmap[key] = val lstMap["$addToSet"] = subchildmap } else { lstMap["$addToSet"] = bson.M{key: bson.M{"$each": value}} } fmt.Println(reflect.TypeOf(lstMap)) } else if _, ok := lstMap[Operation]; ok { childmap := lstMap[Operation] subchildmap := childmap.(map[string]interface{}) subchildmap[key] = value lstMap[Operation] = subchildmap } else { childmap := make(map[string]interface{}, 0) childmap[key] = value lstMap[Operation] = childmap } return lstMap }
这是你可以尝试的
func (o *MongoOps) AddToBsonMapElement(lstMap map[string]interface{}, Operation string, key string, value interface{}) (result map[string]interface{}) { status, msg := EmptyStructCheck(o) if status == true { LogError(msg) panic(msg) } if Operation == "$addToSetEach" { if _, ok := lstMap["$addToSet"]; ok { childmap := lstMap["$addToSet"] subchildmap := childmap.(map[string]interface{}) var val map[string]interface{} val = make(map[string]interface{}) val["$each"] = value subchildmap[key] = val lstMap["$addToSet"] = subchildmap } else { lstMap["$addToSet"] = bson.M{key: bson.M{"$each": value}} } fmt.Println(reflect.TypeOf(lstMap)) } else if _, ok := lstMap[Operation]; ok { childmap := lstMap[Operation] subchildmap := childmap.(map[string]interface{}) subchildmap[key] = value lstMap[Operation] = subchildmap } else { childmap := make(map[string]interface{}, 0) childmap[key] = value lstMap[Operation] = childmap } return lstMap }
This is what you can try
相关问答
更多如何使用Go和mgo使用mongodb投影?(How can I use mongodb projections with Go and mgo?)
如何根据输入创建bson地图(how to create bson map based on input)
使用golang和mongodb进行顺序查询(Sequential queries with golang & mongodb)
Golang获取特定结构字段名称的字符串表示(Golang get string representation of specific struct field name)
mgo具有聚合和分组功能(mgo with aggregation and grouping)
使用预先构建的字符串作为bson.M以便在mgo中进行查询(Use a pre-constructed string as bson.M for mgo query in go)
Golang BSON转换(Golang BSON conversion)
golang中的Mongodb聚合(Mongodb aggregation in golang)
如何将bson.M元素列表合并到golang中的mongo中的单个bson.M中?(How do i combine list of bson.M elements into a single bson.M in mongo in golang?)
用户搜索Golang mgo(User search with Golang mgo)
相关文章
更多Stack Overflow Architecture Update - Now At 95 Million Page Views A Month
Java-based 实现的索引复制
Solr Architecture[转]
hadoop发行版本
铁杆Java开发者不一定最适合Hadoop
网站架构之分库设计
RFC2848--The PINT Service Protocol: Extensions to SIP and SDP for IP Access to Telephone Call Services
Yupoo网站架构学习总结(转)
[How to] Make custom search with Nutch(v 1.0)?(转)
(转)云计算核心论文
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!