How To Estimate Network Ingress and Egress (Bytes) Within a Build

Viewing Network Ingress and Egress

You can view details of your organization's network transfer and storage usage on your Plan > Plan Usage screen. In addition, you can find out more about how to manage your network and storage costs here.

However, you may like to determine the network transfer (ingress and egress) of a specific build. This may be useful for your team, in order to diagnose which processes in the build may be consuming high network transfer usage for instance.

For Docker-based jobs, we can look at the networking information, particularly from `/proc/net/dev`, to figure out the network transfer, before and after a specific command.

cat /proc/net/dev

 

Extending on the method above, here is an example Orb that will calculate the stats in a readable format. We can see it in action with an example screenshot below:

image.png

To illustrate how to use the network command of this Orb, you can set up your config file like this to see how many bytes are transmitted and received for a cURL request, for example:

version: '2.1'

orbs:
profiling: nanophate/docker-profiling@0.3.0

jobs:
build:
docker:
- image: cimg/base:stable
steps:
- checkout
- profiling/network


NOTE: Your overall Network Transfer amount is not representative of your billable usage. Only certain actions will result in network egress, which in turn results in billable usage. For more information, do check out our guide here: https://circleci.com/docs/2.0/persist-data/#overview-of-storage-and-network-transfer

 

Was this article helpful?
0 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.