保持 JVM 在 iseries 上运行
我们正在 iseries 机器上调用 Java 程序,并且对该程序的第一次调用非常慢。以下调用很快,但如果我们等待一定时间,调用又会变慢。
如何保持 JVM 正常运行或者是否有其他方法来解决这个问题?
谢谢
We are calling a Java program on a iseries machine and the first call to the program is quiet slow. The following calls are fast but if we wait a certain time the call is slow again.
How can I keep the JVM up and running or is there another way to solve this problem?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最新的 JVM(IBM Technology for Java)是最快的。典型的问题是,如果 JVM 自己的 jar 缓存在内存中,那么加载速度相当快 - 如果没有,则需要根据需要从磁盘加载它们,这相当慢。 (Windows下实际上有一个加速过程)。
您可以考虑使用一个小脚本,每隔 X 秒读取 JVM 的所有 jar,或者实现“通过数据队列与守护进程 JVM 通信”,这是传统的方法。
The newest JVM's (IBM Technology for Java) are the fastest available. The typical problem is that if the JVM's own jars are cached in memory then it is quite fast to load - if not, they need to be loaded from disk as needed which is quite slow. (There is actually an accelleration process for this under Windows).
You could consider having a small script which simply reads through all the jars for the JVM every X seconds, or to implement a "communicate with daemon JVM through dataqueues" which is the traditional approach for this.
您可能需要考虑使您的 java 应用程序成为始终运行的服务器...您的本机应用程序可以发送和发送消息。使用 TCP 或数据队列接收对服务器的请求。
这样,服务器的启动成本是一次性的,任何用户都不必承受它。
You might want to consider making your java application a server that is running all the time ... your native app can send & receive requests to the server using tcp or data queues.
That way the start up cost for the server is a one time thing and none of the users never have to suffer through it.
为运行 JVM 的子系统分配更多内存。
不要调用静态方法,因为根据定义,静态类不必保留在内存中。
请使用 *this 调用方法。
祝你好运
Allocate more memory to the subsystem the JVM is running in.
Do not call a static method because by definition a static class doesn't have to stay in memory.
Do call methods with *this.
Good Luck