Open danking opened 1 year ago
I can write an RFC for how to do this with regards to billing updates and the database. I don't think it's too difficult, but it will take a bit of work to add some new metadata that says whether a resources is by_time
or by_unit
and compute usage accordingly per billing update. If we are just using the bytes uploaded and downloaded that are tracked by the resource usage monitor, then I think we can do a first pass at adding this functionality. If we have to track by IP address, I don't know how to do that and would have to look into it.
On the first sentence, RFC would be great, and yeah, having a by_time and by_unit would be generally useful. It might be nice to eventually charge a fixed per-job fee if pre-job costs begin to dominate for short lived jobs.
On the last sentence:
There are two major questions, the first of which is much higher priority. We probably need to do a bit of research, at least on the second question.
How can we allow public Internet egress without risking untracked cost? I suspect we must track bytes and charge some, possibly very high, rate.
How can we allow public Internet egress at or near the real cost to us?
The second question is complex because Google's egress pricing is complex. To directly respond to your comment: I don't think we need to disaggregate by destination IP address, but we do need to disaggregate by destination "type & location". GeoIP might allow us to do this in iptables, we should figure out what is and isn't possible and how hard it would be.
The following is distilled from Network Pricing.
There are six types of egress:
Egress types (3) and (5) do not apply to us because hail-vdc does not have Spanner and user jobs cannot read from hail-vdc buckets. Egress types (4) and (6) are slightly ambiguous. We should create a support ticket to verify, but I believe they're charged just like (2). This means we are concerned with just two types of egress:
Each type has a different cost table based on the destination location. In these tables, the cheapest price applies, so, for example, for traffic form us-central1-a to us-central1-a the within-zone price applies, not the within-region price.
VM-to-Internet. Prices decrease with more usage.
Premium Tier Networking (we are using this currently). For the first 1 TiB:
Destination | Cost (USD per GiB) |
---|---|
Anywhere except China, except Australia, but including Hong Kong | 0.12 |
China except Hong Kong | 0.23 |
Australia | 0.19 |
Location Type | Cost (USD per GiB) |
---|---|
Within-Zone | 0.00 |
Within-Region (but different Zones) | 0.01 |
Within-US/Canada | 0.01 |
Within-Europe | 0.02 |
Within-Asia | 0.05 |
Within-South-America | 0.08 |
Within-Oceania | 0.08 |
Across continents except to/from Indonesia and Oceania | 0.08 |
To/from Indonesia or Oceania | 0.15 |
And to directly respond to this comment:
If we are just using the bytes uploaded and downloaded that are tracked by the resource usage monitor, then I think we can do a first pass at adding this functionality.
This sounds great! This would resolve question 1 and eliminate the risk. We should charge the highest possible price: 0.23 USD/GiB. Answering question 2 can proceed slowly and carefully knowing that we don't have a cost risk.
What happened?
Bytes egressing from Batch workers to the public internet are not free. We should track every egressing byte and assign the cost of that byte to the job which produced it.
I believe there are two ways to trigger substantial egress:
Pulling an image shouldn’t trigger substantial egress.
In the first case, there are three kinds of possible egress:
I believe (2) and (3) are charged equivalently. (1) is simply Internet egress pricing. In (3), I’m not sure who pays the egress from a VM to a bucket in a different region. I assume the VM owner.
In all three cases, the destination’s location matters. For public Internet egress, we can use GeoIP to determine the region of the planet. I’m not sure if we can determine the region of (2) and (3). If we can’t, we should either prevent such traffic or we should charge the maximum egress.
A final caveat is that we use Premium Networking. As a result, our traffic can use Google’s internal backbone. It’s not clear to me if this means that a packet from us-central to a public IP in Australia incurs just Internet egress or that and a region-to-region egress to pay for the use of GCP’s internal global backbone.
The priority of various considerations:
Version
0.2.120
Relevant log output
No response