Over the last couple of years we've had the pleasure of serving billions of float requests to CSGOFloat Extension users and API consumers. This post will detail some of the process that entails hosting the service.
As a primer, CSGOFloat API allows users to fetch item data such as the "float value" and "paint seed" of CS:GO skins which determines how worn the item is and random displacement of the texture. This is used heavily by traders when evaluating the value of an item.
Natively Steam inventories don't show this information and requires a third-party add-on, such as our extension, in order to show.
How We Retrieve Item Data
Back in the day, there used to exist an endpoint which, using a Steam Web API Key, would provide detailed item data about a user's inventory. Unfortunately this endpoint was incredibly unreliable, spammed heavily, and eventually shut down by Valve.
After this was shut down, the community had to migrate to a separate method which involves impersonating the Protobufs that the game uses to connect to the CS:GO Game Coordinator and "inspect" the item.
There is a big limitation to this however, one of which being that the "inspect" protobuf call is limited to 1 request per second. In order to serve hundreds of requests per second, this will simply not be enough, so it's time to parallelize...
Parallelizing CS:GO Network "Clients"
Running hundreds of actual game instances in order to fetch this data isn't feasible or maintainable, so the community has developed projects such as node-csgo and node-globaloffensive that has the ability to emulate the network requests that the real CS:GO client uses in order to interact with the Game Coordinator.
In doing so, we can "run" hundreds of network clients at once that will fetch item data on-demand from a pool of API requests and queue them up properly on commodity hardware. Granted, this does require creating hundreds of Steam accounts, but that's the price you pay (well, more free since CS:GO went free-to-play).
Caches Are Crucial
So we have the ability to fetch the data for a couple hundred items per second, now what? Well, it turns out that CS:GO's Game Coordinator isn't the fastest thing in the world.
If we fetch item data from the Game Coordinator, it typically arrives in 500-700 milliseconds. There are also many instances in which the coordinator drops messages as well, so we have to contend with retrying requests if it doesn't reply in time.
As a result we have a cache, which is effectively FloatDB, which serves two purposes: 1) It allows us to lookup a previously fetched item in <1ms 2) It allows users to search across all skins in the game.
In addition to this, many requests are duplicates, so we have a Cloudflare edge-cache that can re-deliver a response closer to your geographic location. As more people use the CSGOFloat API, our cache (FloatDB) becomes more comprehensive, which makes the API calls for all users faster – it's a win-win.
Our float fetching service is available as Open Source on GitHub if you'd like to host it yourself and fetch item data.