# How often to log to avoid slow down of code?

**URL:** <https://community.wandb.ai/t/how-often-to-log-to-avoid-slow-down-of-code/516>\
**Category:** W&B Help\
**Created:** [September 11, 2021, 5:15pm UTC](https://community.wandb.ai/t/how-often-to-log-to-avoid-slow-down-of-code/516 "2021-09-11T17:15:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brando](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/brando/32/199_2.png) [@brando](https://community.wandb.ai/u/brando)\
**Post date:** [September 11, 2021, 5:15pm UTC](https://community.wandb.ai/t/how-often-to-log-to-avoid-slow-down-of-code/516/1 "2021-09-11T17:15:14Z")

</div>

Just curious, do ppl sync artifacts with wandb’s cloud stuff every time they log or less often? I was curious to know if calling `wandb.log` or logging artifacts was slow or does it use a different process and thus slow down is minimum? … (in the past I discovered that the slowest part of my code was model checkpointing)

---

<div class="post-metadata">

**Author:** ![charlesfrye](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/charlesfrye/32/52_2.png) [@charlesfrye](https://community.wandb.ai/u/charlesfrye)\
**Post date:** [September 13, 2021, 5:04pm UTC](https://community.wandb.ai/t/how-often-to-log-to-avoid-slow-down-of-code/516/2 "2021-09-13T17:04:18Z")

</div>

The hard work of `wandb.log` runs in a different process, so that it doesn’t always slow down your code.

The rough guideline we give in our [Technical FAQ](https://docs.wandb.ai/guides/technical-faq) is that you shouldn’t see a performance impact if you are [“logging less than once a second and logging less than a few megabytes of data at each step”](https://docs.wandb.ai/guides/technical-faq#will-wandb-slow-down-my-training). That Technical FAQ has lots more useful information about the technical details of `wandb` logging.

Two caveats on avoiding slowdown:

1. If you’re writing to disk (e.g. with [`torch.save`](https://pytorch.org/tutorials/beginner/saving_loading_models.html)) as part of your checkpointing, that might slow your training down, even though the W&B logging component of checkpointing does not. If that’s a bottleneck, you could handle writing the model to disk in a separate process.
2. `wandb.log` runs in a separate process, but that process needs to finish before the process that created it, the process where you called `wandb.init`, can finish. So if you’ve called `wandb.log` on a large amount of data during training, when your training run finishes, it could take some time for the information to be fully uploaded. You can avoid this with [`WANDB_MODE=offline`](https://docs.wandb.ai/guides/technical-faq#can-i-run-wandb-offline), which only saves information locally – synchronization with the cloud service is then done separately (e.g. manually or via cron job).

FYI, we also have [a short colab](http://wandb.me/log-hf-colab) about ways to reduce the weight of high-frequency logging for metric data using downsampling, summary statistics, and histograms.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [April 20, 2022, 6:02pm UTC](https://community.wandb.ai/t/how-often-to-log-to-avoid-slow-down-of-code/516/3 "2022-04-20T18:02:05Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
