设计可扩展的应用程序
启动一个新的电子商务项目,它基本上由两个主要的独立项目组成:一个核心应用程序和一个 Web 客户端。
核心应用程序将充当服务提供商、Web 客户端(或其他客户端)的后端,以 REST-ful Web 服务/JSON 形式公开其所有功能。
Web 客户端将充当核心应用程序的前端和服务使用者。
这两个项目都主要基于:Spring、Apache CXF、Maven、Tomcat 或 Jetty。 Git 作为版本控制系统。 CouchDB 作为数据库。还有像 Memcached 这样的分布式缓存系统。
原则是以可扩展且可分布在互联网上多个节点上的方式设计项目(核心和网络)。
也许这个主题太大、太复杂,无法在一个主题中讨论;我们的想法是在继续实施之前放置有助于做出正确决策的主要标题。
问题:
- 根据上述技术堆栈,哪些内容可能会缺失或值得添加?
- 有任何涉及该主题的书籍、材料或案例研究推荐吗?
Starting a new project an e-commerce, that basically consists of two, main separated projects: a core application and a web client.
Core app would act as a service provider, the back-end for the web client (or other clients), exposing all its functionality in REST-ful web service/JSON.
Web client would act as a front-end and a service consumer for the core app.
Both project are mainly based on: Spring, Apache CXF, Maven, and either Tomcat or Jetty.
Git as VCS. CouchDB as the DB. Also a distributed caching system like Memcached.
The principle is to design the project (both core and web) in a way to be scalable and distributable on several nodes on the internet.
Perhaps the subject is too big and complex to discuss in one topic; the idea is to put the main headlines that would assist on making the right decisions before going on with the implementation.
The questions:
- Based on the technology stack above, what could possibly be missing or worth adding?
- Any books, materials or case studies recommendation that touch on the subject?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在服务器端,您应该以这样的方式构建 URL 和应用程序状态:它们可以静态生成并通过 apache 等 Web 服务器提供服务,也可以由应用程序服务器动态生成和提供服务。静态内容生成是一种非常有效、相当简单的提高性能的方法。无论如何,让 API 点与实现无关通常是一个很好的做法。
高性能网站有一些很棒的东西。另外,请查看 Squid 进行 HTTP 缓存。
On the server side, you should structure your URLs and application state in such a way that they can either be generated statically and served via a web server like apache, or dynamically generated and served by the app server. Static content generation can be a pretty effective, reasonably straightforward way to improve performance. Having your API points to be implementation agnostic is generally a good practice anyways.
High Performance Websites has some great stuff. Also, check out Squid for HTTP caching.
查看 CQRS 原则。尽管出色的可扩展性只是应用 CQRS 的副作用,但它非常适合云计算,其主要目标是提供弹性的可扩展性。 这是来自 Greg Young 课堂的精彩视频。
附言。尽管大多数材料都基于 .NET 堆栈,但这些原则是跨平台的。
Take a look at CQRS principles. Even though great scalability is only side effect of applying CQRS, it ideally fits for cloud computing which main goal is to provide elastic scalability. Here is a awesome video from Greg Young's class.
PS. Despite most of materials are based on .NET stack, these principles are cross-platform.
@Ellead:通过Tomcat集群(会话复制):http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html
只需在spring中处理单例对象(记住单例是每个JVM的)
@Ellead:Go through Tomcat clustering (session replication) :http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html
Just take care of singleton objects in spring (keep in mind singleton is per JVM)
您没有提到性能和负载测试 - 您也应该测量应用程序的性能和可扩展性:
不要期待或猜测任何事情并尽快开始 - 仅此一点就可以为您节省财富。
对于基于 REST 的解决方案,请查看 Apache httpd 和 mod_jk 的负载平衡。
You did not mentioned performance and load testing - you should measure performance of your application and scalability too:
Do no expect or guess anything and start as soon as possible - that alone will save you fortune.
For REST-based solution look at Apache httpd and mod_jk for load-balancing.