如何增加交换大小可以增加堆大小? [英] How increasing swap size allow me to increase the heap size?

查看:198
本文介绍了如何增加交换大小可以增加堆大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ubuntu服务器,我有8 GB的RAM。当我尝试将堆大小设置为8GB时,我的Web服务器(weblogic)无法启动。但是,如果我将交换大小
增加到大小为11 GB,网络服务器就开始了。

I have ubuntu server where i have 8 GB of RAM. When i try to give the heap size as 8GB, my web server(weblogic) does not start. But if i increase the swap size to Size to 11 GB, webserver got started.

所以我的问题是如何为我的网络分配8GB堆大小服务器(当有8 GB RAM,其中OS需要1到2 GB)后增加
交换大小?

So my question is how i can allocate 8GB heap size to my web server (when ihave 8 GB RAM out of which 1 to 2 GB is required for OS) after increaing the swap size ?

推荐答案

执行。不。这样做。

获得更多内存。

Java和Swap Do.不。混合。 Java和Swap就像Crossing the Streams一样糟糕。

Java and Swap Do. Not. Mix. Java and Swap are like "Crossing the Streams" Bad.

Java堆的一部分将被换出,然后Java会GC,这会严重破坏这个盒子,堆的一部分仍将被换出,Java将再次使用GC。

Part of the Java heap will be swapped out, then Java will GC, which will thrash the box terribly, and still part of the heap will be swapped out, and Java will GC again.

冲洗并重复直至最终杀死-9 Weblogic。

Rinse and repeat until you finally kill -9 Weblogic.

获得更多内存,或者不需要。交换不是一种选择。

Get more memory, or do without. Swap is not an option.

附录:

您的机器具有虚拟内存(VM)。通过添加swap,可以扩展该VM。当您有比实际内存更多的VM时,机器将交换非活动内存页面到交换空间,然后交换要从交换空间进入RAM的活动页面。如果你有一堆很少需要时间的空闲进程,这并不是非常糟糕。

You machine has "Virtual Memory" (VM). By adding swap, you extend that VM. When you have more VM than actual memory, then the machine will "swap out" inactive memory pages to the swap space, and then "swap in" pages that want to be active from swap space in to RAM. If you have a bunch of idle processes that rarely need time, this isn't super terrible.

但Java放大了这个问题。当物理RAM耗尽时,某些RAM会被换出到磁盘。当某些RAM是Java堆时,那么当垃圾收集器启动时你会遇到很大的问题。因为,一般来说,GC会触及堆的每一页。这意味着所有堆页面都需要活跃,因此,交换。

But Java magnifies the problem. When you run out of physical RAM, some of that RAM is swapped out to disk. When some of that RAM is Java heap, then you have a big problem when the garbage collector kicks in. Because, in general, the GC touches every page of the heap. That means that all of the heaps pages need to be "active", and thus, "swapped in".

但如果它们不适合,那么你有一个像8拼图的问题。你在磁盘上移入和移出内存的地方。这称为颠簸。

But if they don't fit, then you have a problem like the 8 puzzle. Where you're shifting memory in and out from disk. This is called thrashing.

作为GC的交换JVM堆是最坏情况下颠簸的教科书案例。

A swapped JVM heap that is GC is the text book case of worst case thrashing.

机器让你分配额外的内存,因为它认为你有更多,因为你的虚拟内存(物理RAM +交换)更大。

The machine is letting you allocate the extra memory because it thinks you have more, since your Virtual Memory (physical RAM + swap) is greater.

这篇关于如何增加交换大小可以增加堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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