确保您的 .NET 代码能够良好扩展的最佳实践有哪些?
上周我面试了东北部一家 TripleA MMORPG 游戏公司的职位。我没有得到这份工作,但面试期间出现的问题之一是您编写的代码的可扩展性以及如何在架构和类设计的早期考虑它。
遗憾的是,我从来没有考虑过我所编写的 .NET 代码的可扩展性(我使用单用户桌面和移动应用程序,我们主要关心的通常是设备内存和数据传输速率)。我有兴趣了解更多有关编写可扩展的代码的信息,以便它可以在客户端服务器环境中处理各种远程用户,特别是 MMORPG。
有没有任何书籍、网站、最佳实践等可以让我开始研究这个主题?
Last week I interviewed for a position at a TripleA MMORPG game company here in NE. I didn't get the job but one of the areas that came up during the interview was the about the scalability of the code that you write and how it should be considered early on in the design of your architecture and classes.
Sadly to say I've never thought very much about the scalability of the .NET code that I've written (I work with single user desktop and mobile applications and our major concerns are usually with device memory and rates of data transmission). I'm interested in learning more about writing code that scales up well so it can handle a wide range of remote users in a client server environment, specifically MMORPGs.
Are there any books, web sites, best practices, etc. that could get me started researching this topic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是一些可以开始的地方:
http://highscalability.com/blog/2010/2/8/how-farmville-scales-to-harvest-75-million-players-a-month.html
http://www.cs.cornell.edu /people/~wmwhite/papers/2009-ICDE-Virtual-Worlds.pdf
特别是,http://highscalability。 com 是关于可扩展的大型网站及其如何实现的完整文章或文章(Digg、flickr、facebook、YouTube...)
Here are some places to start:
http://highscalability.com/blog/2010/2/8/how-farmville-scales-to-harvest-75-million-players-a-month.html
http://www.cs.cornell.edu/people/~wmwhite/papers/2009-ICDE-Virtual-Worlds.pdf
In particular, http://highscalability.com is full or articles about huge websites that scale and how they do it (Digg, flickr, facebook, YouTube, ...)
我想在此强调一点。只需缓存您的读取即可。制定适当的缓存策略,确定可以缓存哪些对象以及缓存的时间段。拥有分布式缓存场将减轻数据库服务器的负载,这将极大地提高性能。
即使只是将一些数据缓存几秒钟(在非常高负载的多用户场景中)也会为您带来巨大的好处。
Just one point I'd like to highlight here. Just cache your reads. Work out a proper caching policy where you determine which objects can be cached and for what periods. Having a distributed caching farm will take load off your DB servers, which will greatly benefit performance.
Even just caching some pieces of data for a few seconds - in a very high load multi-user scenario - will provide you with substantial benefit.
如果您正在寻找物理验证,我通常发现做一些原型制作会有所帮助。这通常可以让您很好地了解设计中可能存在的任何不可预见的问题以及添加到设计中的难易程度。我会尝试应用任何可能的设计模式以允许未来的可扩展性。 可重用面向对象软件的元素是一个很好的参考。 这里是一些很好的示例,显示了使用设计模式的代码之前和之后。这可以帮助您直观地了解设计模式如何使您的代码更具可扩展性。 这里是一篇关于特定设计模式的SO帖子软件可扩展性。
If you are looking for physical validation, what I usually find that helps is doing some prototyping. This gives you a good idea usually of any unforeseen problems that might be in your design and just how easy it is to add onto it. I would try to apply any design patterns possible to allow future scalability. Elements of Reusable Object-Oriented Software is a great reference for that. Here are some good examples that show before and after code using design patterns. This can help you visualize how design patterns could make your code more scalable as well. Here is an SO post about specific design patterns for software scalability.