跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 关于 Docker 的内存恢复问题,求问,在线等

发表于

背景

设备是 mbp m3 16G 内存的。

因为 m 芯片并不好安装 xgboost 等库,经过一番搜索了解到可以使用 Docker

通过摸索构建了一个基于 Python 的镜像(包含 xgb 等机器学习库)

但是在训练模型的时候,经常报错,表现为 notebook 崩溃需要重来,或者是 python 脚本 killed

相关设置

经过进一步搜索,发现可能和内存、cpu 有关。

我在创建容器的时候,并没有指定一些 cpu 、内存的参数,在 desktop 中已经将相关设置拉满了

"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": [],
"BlkioDeviceWriteBps": [],
"BlkioDeviceReadIOps": [],
"BlkioDeviceWriteIOps": [],
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,

oKDBMmh

理论上这不就是可以随意使用 mbp 的内存和 cpu 了?

进一步发现

进一步在重现问的时候,使用 docker stats 发现,在数据读取和处理的时候,

1 、cpu 和 内存使用都会涨,在数据读取完之后,cpu 立刻 0%,但是 mem usage 没有变化,还是 10G 左右,继续执行代码,马上就崩溃了,为啥内存不会恢复?

2 、即使没有限制使用 cpu 核心数,但是数据处理的时候, 容器的 cpu 占比可能 200%,但是电脑还是有 50% 的 cpu 剩余,为啥用不满?

3 、在建模的时候,容器的 cpu 可以飙升到 600%,但是内存使用居然没有用满?

疑问

实在是不怎么使用 docker ,总是感觉是不是容器不能很好的利用 mbp 的资源,理论上是比较好的设备了,居然跑个 xgb 跑不动

还是是我的数据量太大了吗?(差不多 15w 行 x 1000 列)

Featured Replies

没有可显示的帖子

创建帐户或登录来提出意见

Account

导航

搜索

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.