JVM-我应该分配多少RAM [英] JVM - How much RAM should I allocate

查看:77
本文介绍了JVM-我应该分配多少RAM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有找到关于我实际上应该分配给JVM多少RAM的建议.

I didn't find a suggestion on how much RAM I actually should allocate to the JVM.

假设我的计算机具有4GB RAM并运行Windows10.我几乎只在其上使用Java应用程序.我应该在多少RAM中启动JVM?系统本身也需要RAM,因此根据我的逻辑,即使有可能,我也不应该分配4 GB.

Assuming that my computer has 4GB RAM and runs Windows 10. I nearly only use Java Applications on it. With how much RAM should I start the JVM? The system needs RAM for itself too, so in my logic, I should not allocate 4 GB even if that is possible.

这不是一个黑白问题,我只想有一个想法以及如何回答这个问题.

This isn't a black/white question, I just want to have an idea and how to come to an answer in this question.

推荐答案

我没有找到关于我实际上应该分配给JVM多少RAM的建议.

I didn't find a suggestion on how much RAM I actually should allocate to the JVM.

JVM的默认设置是主内存的1/4.如果您有4 GB,则默认为1 GB.

The JVM has a default setting of 1/4 of main memory. If you have 4 GB it will default to 1 GB.

注意:这是一个很小的系统,您会得到一些具有如此大内存的嵌入式设备和电话.

Note: this is a pretty small system and you get get some embedded devices and phones which this much memory.

如果您有能力购买更多的内存,它将使您的生活更轻松.

If you can afford to buy a little more memory it will make your life easier.

我几乎只在上面使用Java应用程序.我应该在多少RAM中启动JVM?

I nearly only use Java Applications on it. With how much RAM should I start the JVM?

除非您有理由更改命令行参数,否则我将保持原样.

Unless you have a reason to change a command line parameter I would leave it as it is.

注意:您的操作系统将需要一些内存,也许是1 GB,并且您想为缓存等留出1 GB的可用空间,因此您可以将堆大小增加到2 GB,但这仅在需要时可用.

Note: you OS will need some memory, perhaps 1 GB and you want to leave 1 GB free for caching etc, so you could increase the heap size to 2 GB, but only if you needed to.

如果我并行运行4个程序怎么办?我仍可以为每个程序分配2GB吗?

What if I run 4 programs in parallel? Can I still allocate 2GB for every of that program?

是的,但这是一个非常糟糕的主意.您的应用程序将开始交换,并且您的计算机可能无法使用.我会尽量将这台机器的总容量控制在2 GB以下.

Yes, but it's a very bad idea. You application will start swapping and your computer can become unusable. I would try to stay under 2 GB total for this machine.

我们这里有一个业务应用程序,经常达到分配的最大Ram,如果用户打开的选项卡"太多,它就会滞后很多.

We have a business application here that often reaches to the maximum allocated Ram, which makes it lag a lot if a user has too many "tabs" open.

在这种情况下,应确保您具有正确的工具来完成工作,这意味着确保系统具有足够的内存. 4 GB的内存价格为$ 18.我想说,如果您有一台具有4 GB的业余PC,则可以获得更多的内存.三年前,我8岁的儿子8岁时给了他一台8 GB内存的PC,因为少买钱没有意义.我将至少获得16 GB或32 GB的存储空间.然后也许值得花一些时间对其进行调整.

In that case, you should make sure you have the right tool for the job which means making sure your system has enough memory. 4 GB of memory costs $18. If you had a hobby PC with 4 GB, I would say, get more memory. Three years ago, my 8 year old son when he turned 8 I gave him a PC with 8 GB of memory because it's didn't make sense to buy less. I would just get 16 GB or 32 GB minimum. Then its worth spending some time tuning it, maybe.

这篇关于JVM-我应该分配多少RAM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆