如何*实时*检查 VPS 中可用的总 RAM 内存..?
我最近购买了一个 VPS,理论上它应该为我提供 1 GB 专用内存和另外 1 GB 可突发内存...因此,在任何给定时间,我可用的内存总量应该在 1 之间GB 和 2 GB,对吗?如果我错了,请纠正我。
我如何从我的 Ubuntu VPS 中检查这一点?这样我就知道我得到了我所付出的代价..
我想检查一下,因为我在VPS上安装了Java,并且由于可用内存不足而无法运行..
顺便说一句,我知道' free'命令...问题是,它能达到我的目的吗?
编辑:我认为内存不足的原因是当我打开 VPN 会话并在控制台中输入 java
时,我得到以下信息错误:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
但是,如果我重新启动 VPS 并且不启动 VPN 服务,而是再次通过 ssh 登录并输入 java
,我会得到正确的响应(列出所有 java 参数等)。 ..
I recently purchased a VPS, and on paper its supposed to give me 1 GB of dedicated memory and another 1 GB of burstable memory ... So at any given time, the total amount of memory that should be available to me should be between 1 GB and 2 GB, right ? Correct me if I'm wrong ..
How can I check this from within my Ubuntu VPS ? So that I know I'm getting what I'm paying for ..
I want to check this because I installed Java on the VPS, and its not running due to having insufficient memory available ..
By the way, I know of the 'free' command ... Question is, would it serve my purpose ?
EDIT: The reason why I think I'm running low on memory is because when I have a VPN session on and I type in java
in the console, I get the following error:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
However, if I restart the VPS and do not start the VPN service, and instead just login through ssh again and type in java
, I get the correct response (all java parameters listed, etc) ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Java 只需 64MB RAM 即可在 Linux 机器 http://www.java 上运行。 com/en/download/help/sysreq.xml
如果打印“内存不足错误”,则问题可能出在您的 Java 程序中。
要检查 Linux 中的内存分配,请使用 free 命令或“cat /proc/meminfo”
Java only required 64MB of RAM to run on Linux box http://www.java.com/en/download/help/sysreq.xml
If it print "out of memory error", then the problem probably in your Java program.
to check memory allocation in Linux, use free command or "cat /proc/meminfo"
这些操作方法将使用 watch 命令检查 Linux VPS 中可用的实时 RAM 内存使用情况。
一个。使用“top”命令检查内存使用情况。 top 命令不需要 watch 命令,因为 top 将定期更新结果。 :
顶部
B.使用“/proc/meminfo”和 watch 命令检查内存使用情况:
watch -n 1 cat /proc/meminfo
c.使用 watch 命令的“free”检查内存使用情况:
watch -n 1 free
d.使用“vmstat”和 watch 命令检查内存使用情况:
watch -n 1 vmstat
These howto will check realtime RAM memory usage available in Linux VPS using watch command.
a. Check memory usage using “top” command. Watch command not required for top command as top will update the result periodically. :
top
b. Check memory usage using “/proc/meminfo” with watch command :
watch -n 1 cat /proc/meminfo
c. Check memory usage using “free” with watch command :
watch -n 1 free
d. Check memory usage using “vmstat” with watch command :
watch -n 1 vmstat
您可以使用 htop 查看实时使用情况,而不是查看静态使用的内存。建议的所有命令都会显示某个时间点可用/已使用的内存。 htop 允许您查看以 1 秒为间隔更新的专用 RAM 和交换 RAM 使用情况,这使得您可以更轻松地了解您的服务 RAM 需求。 htop 还显示 CPU 的实时使用情况。
在 ubuntu 上运行此命令来安装 htop,
然后运行 htop 祝
你好运
instead of viewing the static used memory, you can view the live usage using htop. all of the commands suggested show the ram available/used at a point in time. htop allows you to view the dedicated ram and the swap ram usage updated in 1 second intervals which makes it easier to understand your services ram needs. htop also shows the live usage of your cpu's.
Run this command on ubuntu to install htop
then run htop with
good luck