虚拟化应用程序的编程注意事项
SO 有很多问题询问虚拟化对于开发和测试的利弊。
我的问题略有不同 - 在虚拟化很普遍的世界中,程序员在编写可以部署到虚拟化环境中的软件时应该考虑哪些事情?我最初的一些想法是:
- 检测应用程序的另一个实例是否正在运行
- 与硬件(物理/虚拟)
- 通信 资源限制(为在单 CPU 虚拟机上运行的多核 CPU 编写的应用程序)
还有其他吗?
There are lots of questions on SO asking about the pros and cons of virtualization for both development and testing.
My question is subtly different - in a world in which virtualization is commonplace, what are the things a programmer should consider when it comes to writing software that may be deployed into a virtualized environment? Some of my initial thoughts are:
- Detecting if another instance of your application is running
- Communicating with hardware (physical/virtual)
- Resource throttling (app written for multi-core CPU running on single-CPU VM)
Anything else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您已经掌握了这三大要点的大部分基础知识。注意:
You have most of the basics covered with the three broad points. Watch out for:
根据我的经验,您实际上只需要关心几件事:
您的应用程序不应该因为 CPU 时间短缺(即使用超时太紧)而失败
不要使用低优先级始终运行的进程在后台执行任务
不要相信操作系统关于系统负载的说法
几乎任何其他问题都应该不是由应用程序处理,而是由虚拟器、主机操作系统或您首选的系统管理员处理:-)
In my experience there are really only a couple of things you have to care about:
Your application should not fail because of CPU time shortage (i.e. using timeouts too tight)
Don't use low-priority always-running processes to perform tasks on the background
The clock may run unevenly
Don't truss what the OS says about system load
Almost any other issue should not be handled by the application but by the virtualizer, the host OS or your preferred sys-admin :-)