构建具有无限内存使用的运行jar。

huangapple go评论65阅读模式
英文:

Build jar with unlimited RAM usage on running

问题

我正在构建一个非常复杂的软件,将用于生产,并将在服务器上作为服务运行。
在运行时,我需要设置这个JAR文件的最大RAM使用量,根据我的程序进行一些计算。我已经看到有一些在运行构建的程序之前设置内存的方法,但我想在运行时设置JAR文件将使用多少内存,这是否可能?

英文:

I am building a very complex software that will be used for production and will run on a server as a service.
I need to make this jar have set max RAM usage when running with some calculations made by my program, i have seen that there are ways for setting the memory before running the built program, but i would like to set how much memory the jar is going to use when i am running it, is this possible?

答案1

得分: 1

这里有两个问题。如上所述,您只能请求最多特定数量的内存。高效的垃圾回收可以帮助您回收不再需要的内存。

第二个,而且可能是真正的问题是如何测量应用程序实际使用了多少内存。有许多框架(例如,JMeter)可以测量使用了多少内存 - 并且可以针对使用的数据量来进行。当进行 NP 完全问题(甚至只是超过 O(n) 的问题)时,从用户的角度来看,这非常有用("在处理多达 2 千|百万|十亿|万亿个对象时表现良好")。

英文:

There are two issues here. As mentioned above, you can only request up to a specific amount of memory. Efficient garbage collection can help you reclaim memory that is no longer needed.

The second, and probably real, issue here is metering how much memory is actually used by the application. There are many frameworks (e.g., JMeter) for measuring how much memory is used - and this can be done with respect to the amount of data used. When doing NP-complete (or even just more than O(n) problems) this can be very useful from the users perspective ("This works well with up to 2 <thousand>|<million>|<billion>|<trillion> objects")

huangapple
  • 本文由 发表于 2020年9月5日 03:46:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/63747215.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定