简体   繁体   English

Jupyter 笔记本在 Microsoft Azure 中运行缓慢

[英]Jupyter notebook running slow in Microsoft Azure

I am quite new to using Microsoft Azure for running jupyter notebooks.我对使用 Microsoft Azure 运行 jupyter 笔记本很陌生。 I noticed that it can take 30-45 seconds to polar plot 2 numpy arrays, which is small relatively small (<300 datapoints per array).我注意到极性 plot 2 numpy arrays 可能需要 30-45 秒,相对较小(每个阵列 <300 个数据点)。 When I have to execute several of these plots, the time adds up, so I am wondering if this is related to a particular compute instance or network latency?当我必须执行其中几个图时,时间会增加,所以我想知道这是否与特定的计算实例或网络延迟有关? Any insight would be greatly appreciated, thank you!任何见解将不胜感激,谢谢!

Notebook will be slow when the data loading limits are high, below is one of the case where I faced similar issue.当数据加载限制很高时,笔记本电脑会很慢,下面是我遇到类似问题的情况之一。

  • Tried to display some 40000 columns, I faced some serious unresponsive issue and slowness.试图显示一些 40000 列,我遇到了一些严重的无响应问题和缓慢。
  • As soon as I changed the code to display only 40 or 80 columns, the response was good.一旦我将代码更改为仅显示 40 或 80 列,响应就很好。

Below are some root causes for this:以下是造成这种情况的一些根本原因:

  • Clean all the data which is related to dataframes like pandas etc.清理所有与数据帧相关的数据,如 pandas 等。

  • From the below block we can get memory and cpu usage, so that it will help us to clear the unwanted data:从下面的块中我们可以得到 memory 和 cpu 使用情况,这样可以帮助我们清除不需要的数据:

     #./usr/bin/env python import psutil # gives a single float value psutil.cpu_percent() # gives an object with many fields psutil.virtual_memory() # you can convert that object to a dictionary dict(psutil.virtual_memory()._asdict()) # you can have the percentage of used RAM psutil.virtual_memory().percent 79.2 # you can calculate percentage of available memory psutil.virtual_memory().available * 100 / psutil.virtual_memory().total 20.8
  • We will have some variable inspectors, if they are enabled the notebook might get slow because of some dataframes like pandas.我们将有一些变量检查器,如果启用它们,笔记本可能会因为 pandas 等数据帧而变慢。 GIT Issue GIT 问题

    If you want to disable it --> Edit --> nbextensions config.如果要禁用它--> 编辑--> nbextensions 配置。

Refer to these SO ( SO1 , SO2 , SO3 , SO4 ) links for detailed explanations.有关详细说明,请参阅这些 SO( SO1SO2SO3SO4 )链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM