Using Firebase I'm giving the fields easily human-readable names, such as "timestamp", "last_changed", "message_direction" etc.
Are the field names part of the data exchange for every single "row"?
Meaning, would I save bandwidth by shortening the field names?
As Frank pointed out: Yes, they do affect bandwidth. However, if you do the math, you'll see that bandwidth is rarely worth the effort and obfuscation, and that generally your data payload will vastly eclipse the few extra characters of the keys.
Let's consider an average chat message:
{
"sender": "typicaluserid:12345678901234567890",
"timestamp": 1410193850266,
"message": "Hello world. All your base are belong to us!"
}
Okay, so first let's look at the payload for this message. This is 163 bytes, UTF-8 encoded. if I changed the keys to meaningless three character ids (e.g. sdr, ts, and msg), then it would be 149 bytes. With some liberal padding for transaction overhead, let's say about 40 bytes, it's about a 2% savings, in exchange for needing a rosetta stone to read my data.
Next, let's consider bandwidth usage. If we have a very active, very massive chat system (i.e. we're raking in serious $$), we might have 10k active users sending an average of 50 messages per day. That means we'd be sending 200 bytes * 500k = 100MB
of data per day, or around 3GB
of data per month.
That means that I could support a massive chat system comfortably on Firebase's free plan without exceeding bandwidth limits.
If we take those 11 bytes, off, we have 189 * 500k * 30 = 2.8GB
. So not a significant difference for the effort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With