Okay, so I’ve been messing around with SaltStack lately, and more specifically, the Salt API. It’s pretty cool for automating stuff, but I wanted to get a handle on how “heavy” it is – like, how much bandwidth it uses when I’m making calls to it. So, I did a little experiment, and here’s how it went down.
Getting Started
First, I needed to have Salt and the Salt API up and running. Thankfully, I already had a master and a minion set up for some other projects. If you don’t, you’ll need to get that sorted first. There are tons of guides online for that part, so I won’t bore you with the details here.
Making Some Calls
Next, I used a pretty simple `curl` command to ping the minion. This is about the most basic thing you can do with the Salt API. I wanted to see the raw size of the response. My command looked something like this:
It is important to note that I am testing with a simple execution, and testing on an enviroment that has only my test minion and the salt master server.
curl -sSk https://your_salt_master:8000/
-H 'Accept: application/x-yaml'
-H 'X-Auth-Token: your_token'
-d client='local'
-d tgt='your_minion'
-d fun='*'
I swapped out `your_salt_master`, `your_token`, and `your_minion` with my actual values. I used YAML for the output because it’s fairly easy to read.
Checking the Size
Now for the important part! Instead of just looking at the output, I wanted to measure the size. I did this on my local machine and tested the response size. Here’s the command.
curl -sSk https://your_salt_master:8000/
-H 'Accept: application/x-yaml'
-H 'X-Auth-Token: your_token'
-d client='local'
-d tgt='your_minion'
-d fun='*' -w '%{size_download}'
That `%{size_download}` part is the magic. It tells `curl` to print out the size of the downloaded data in bytes.
The Results
When I ran that, I got a number back… something like 145. This number is pretty important, This number might seem big, it all really depends, it told me that a simple `*` response, in YAML format, was about 145 bytes. Your mileage may vary, of course, depending on your setup and what you’re asking the minion to do.