Constantin Șerban-Rădoi, backend engineer, walks us by means of the fascinating artwork of scaling up reserving reference numbers. As we’re present process vital development right here at GetYourGuide, Constantin explains how the FinTech group succeeded in creating extra reserving code combos. The group was challenged with preserving codes brief, straightforward for patrons to learn over the telephone, and ensuring the brand new module didn’t by accident generate any dangerous phrases.
At GetYourGuide, we’ve got many shifting elements that maintain the platform operating easily. One of the vital cogs within the machine is reserving reference numbers. Serving as an middleman between vacationers and our partners, such as tour companies, requires us to have a robust system for preserving monitor of the actions offered on our platform.
From the shopper’s perspective, the reserving reference quantity is the one identifier for the exercise they’ve bought on GetYourGuide. This identifier is required by the Customer Service group to allow them to lookup the reserving in our inner methods.
For our companions, the reserving reference quantity is the magic hyperlink between an exercise they supplied to a buyer and the cost that they are going to obtain from GetYourGuide for that reserving.
Operating out of combos
Within the early days of GetYourGuide, the reserving reference quantity seemed like GYGxxxxxxxx, the place xxxxxxxx was an eight digit quantity. This served us nicely till this summer time, it turned clear that we’d quickly want greater than eight digits to check with newer bookings. We would have liked a brand new manner of producing identifiers that had been scalable for a few years to return whereas additionally being backward-compatible.
Options for 1000x extra development
Given the issue at hand, we needed to make it possible for we didn’t break the prevailing performance, and that we may nonetheless lookup bookings that had been accomplished years in the past. The best resolution for this downside was to separate the implementation in two:
For numbers smaller or equal to 99999999 (eight digits), we protect the prevailing algorithm
For numbers higher or equal to 100000000 (>= 9 digits), we create a brand new algorithm
The primary a part of the answer was straightforward as a result of it was already applied. The attention-grabbing half comes subsequent, the brand new algorithm. This algorithm posed a number of constraints:
First, we wished to maintain the size of the reference quantity as brief as doable. This ensures that our clients can simply learn and reproduce this reference quantity over the telephone or on the internet once they would require help from our customer support. Second, we didn’t need to change the algorithm each time we exceeded one other digit, e.g. 10 digits, then 11, and so forth.
Given these constraints, we determined to make use of a bigger set of symbols, letters and digits. This meant that we may, in principle, improve the variety of symbols from 10 to a most of 52 if we had been to make use of all of the digits and all of the English alphabet characters in higher or decrease case. Nonetheless, when being learn from a paper or display voucher and transmitted over the telephone, a few of these characters would look ambiguous. Let’s take a look at a few examples:
GYG00OO12345 – right here, the digit ‘0’ and the letter ‘O’ are very related
GYG11IIll234 – right here, the digit ‘1’ may be very near the higher case letter ‘I’ (i) and the lowercase ‘l’ (L)
GYGaC1l9Ff2T – it might be relatively awkward to inform over the telephone “decrease A, higher C, one, decrease L, 9, higher F, decrease f, two, higher T”
As a result of mixing decrease with higher case characters would trigger confusion, we’ve got determined to solely use higher case characters. Moreover, we’ve got eradicated most vowels from the character set to keep away from unintentionally forming dangerous phrases in addition to some extra characters which might be phonetically shut collectively and will trigger confusion when spelled over the telephone, like ‘C’, ‘D’, ‘S’ and ‘T’.
This meant that for reference numbers containing simply 9 characters we may encode as much as about 10^12 reserving references. For a single-digit improve from eight to 9, we are able to check with 1000 occasions extra numbers than if we used simply digits (0-9).
Earlier than, the reference quantity seemed like this: