WHM/Cpanel 和 Linux 中内存使用的差异

发布于 2024-10-09 21:12:06 字数 165 浏览 6 评论 0原文

如果我转到 WHM 并查看服务器的内存使用情况,它会显示只有 16% 的内存正在使用。 但是当我使用 SSH 连接到服务器并运行命令“free -m”时,它显示 80% 正在使用中。这是为什么?我想知道所有运行的应用程序(如 MySQL、Apache 等)的确切内存使用情况 我如何看待这一点?

谢谢

If I go to WHM and see my server's memory usage, it says that only 16% of memory is in use.
But when I connect to server using SSH and run command "free -m" then it shows that 80% is in use. Why is that? I want to know exact memory usage of all applications running like MySQL, Apache e.t.c.
How do I view that?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿港小镇 2024-10-16 21:12:06

正如他们所说,“这很复杂”。

Linux 使用未使用的内存进行磁盘缓冲和缓存。它加快了速度。但您可能需要查看 free-/+ buffers/cache 行。

'ps' 可以显示任何给定进程或所有进程的 %cpu%mem 累积CPU时间rss(驻留集大小,非-进程正在使用的交换物理内存),大小(如果进程变脏,非常所需的交换空间量所有可写页面,然后被换出),vsize(整个进程的虚拟内存使用量(vm_lib + vm_exe + vm_data + vm_stack))等等。

对于任何给定的进程,您可以 cat /proc/$PID/status —— 它是人类可读的 —— 并检查 VmSizeVmLck , VmRSS, VmData, VmStk, < strong>VmExeVmLibVmPTE 值,以及与其他人...

但这只是对于初学者来说...进程可以分配内存但不能使用它。 (可以分配内存,但内存页面在实际使用之前不会创建/发布。整个按需的事情。)

进程可以在硬件空间中映射,显示为使用大量实际上并未到来的内存来自系统 RAM。 (众所周知,X 服务器有时会这样做。这是一些涉及内核驱动程序的奇怪的东西......)

有可执行文件,通常是内存映射文件。这意味着换入的部分会占用 RAM,但换出时不会占用交换文件空间。

进程可以有其他内存映射文件...

有共享内存库,其中多个程序同时使用相同的 RAM 页。

所以我们不得不问,就记忆而言,到底什么是重要的,什么是不重要的?

As they say, "It's Complicated".

Linux uses unused memory for disk buffering and caching. It speeds things up. But you may need to look at the -/+ buffers/cache line of free.

'ps' can show you, for any given process, or for all processes, the %cpu, %mem, cumulative cpu-time, rss (resident set size, the non-swapped physical memory that a process is using), size (very approximate amount of swap space that would be required if the process were to dirty all writable pages and then be swapped out), vsize (virtual memory usage of entire process (vm_lib + vm_exe + vm_data + vm_stack)), and much much more.

For any given process, you can cat /proc/$PID/status -- it's human readable -- and check out the VmSize, VmLck, VmRSS, VmData, VmStk, VmExe, VmLib, and VmPTE values, along with others...

But that's just for starters... Processes can allocate memory but not use it. (Memory can be allocated, but the memory pages are not created/issued until they're actually used. That whole on-demand thing.)

Processes can map in hardware space, showing up as using a large quantity of memory that's not actually coming from system RAM. (X-servers are known to sometimes do this. It's some wonky stuff involved kernel drivers...)

There's the executable, which is usually a memory-mapped file. Meaning that parts that are swapped-in are taking up RAM, but when swapped out it never takes up swapfile space.

Processes can have other memory-mapped files...

There's shared-memory libraries, where the same RAM pages are used by multiple programs concurrently.

So we have to ask, as far as memory goes, what exactly counts and what doesn't?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文