The Nine Rules of Remoting ( by Ingo Rammer)
2005-10-27 11:26
316 查看
The Nine Rules of Remoting -- Ingo Rammer
Remoting provides a number of features whose applicability differs for a number of usage scenarios. To ensure that your application is reliable, stable, and scalable, you should follow these nine rules if you are communicating between different machines:· Use only server-activated objects configured as SingleCall
· Use the HttpChannel with the BinaryFormatter. Host your components in IIS if you need scalability, authentication and authorization features.
· Use IIS' ability to deactivate HTTP KeepAlives for maximum scalability.
· Use a Network Load Balancing cluster of servers during development if you want to achieve scalability. Make sure to deactivate any client affinity and make sure that you deactivate http keepalives during development!
· Do not use client-activated objects and don't pass any MarshalByRefObject over a remoting boundary. You will easily trap this if you use the .NET Framework version 1.1 which will throw a SecurityException or a SerializationException in this case. (Yes, you could change this setting - but you shouldn't!)
· Do not use events, callbacks and client-side sponsors.
· Do not use static fields to hold state. Instead put ALL state information in your database. If you keep state in memory, you will run into problems if you try to scale your application out to a cluster of servers. Cache information only if it's not going to change (like a list of states or cities) - else you will run into cache-synchronization nightmares on your cluster.
· Do not use Remoting for anything else apart from .NET to .NET communications. Use ASP.NET Web Services and the Web Services Enhancements (WSE) for anything related to SOAP, Service Oriented Architectures and platform independence.
· Do not try to fit distributed transactions, security, and such into custom channel sinks. Instead, use Enterprise Services if applicable in your environment. .NET Remoting isn't a middleware, it is just a transport protocol - if you need services, use a service-oriented framework!
If you follow these guidelines, your Remoting application will be perfectly stable, reliable and scalable.
这些规则主要针对那些cross machine boundaries的分布式应用,cross local machine process/appDomain 不在考虑范围之内
公司里面的Remoting项目基本上都符合了这些rule,只是最后一条偶们通过custom sink去处理安全,授权等内容,一是MS enterprise service研究还不够深入,另外一个是现在有些应用层的IOC/AOP容器也没深入研究过不知道好不好用。另外有些从数据库取出来的枚举值一类的东西Cache在服务器端,是通过Singlteon访问的
相关文章推荐
- The newsletter published by Ingo Rammer
- Writing udev rules by Daniel Drake (dsd) Version 0.74 The most recent version of this document can
- One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot"
- Loadrunner 11在win7录制中失败“the recording of the application was terminated by windows due to window data execution prevention feature"
- The behavior of App killed or restored by Android System or by users
- Book of the Week: NINETEEN EIGHTY-FOUR by George Orwell
- The resource identified by this request is only capable of generating responses with characteristics
- Installation failed with message...It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
- 10 Rules of Good and Bad Studying By Barbara Oakley
- 微软的ERP路线图 The Greening of Microsoft (BY Robert L. Mitchell, IDG News Service,09/03/2005 16:50:01)
- 053-15 Which tasks are run automatically as part of the Automated Maintenance Task by default? (Choo
- P. Hamilton / Quantitative Investigation of QRS Detection Rules Using the MIT/BIH Arrhythmia Databa
- The impression of the speech spoken by Steve Jobs in Stanford University
- The encryption certificate of the relying party trust identified by thumbprint is not valid
- Question 41: Which of the following operators must be overloaded by function objects in the Standard Template Library?
- The 8th tip of SQL design by DB Query Analyzer
- 斯坦福大学的Real-time 3D internal marker tracking during arc radiotherapy by the use of combined MV–kV imaging
- Caused by: java.lang.ClassFormatError: Extra bytes at the end of class file
- julycoding/The-Art-Of-Programming-By-July
- Get the average socre of the student.(The exmaple of group, having and order by).求学生平均分(group, having 和 order by使用示例).