Snowflake Connection Provider
Find the English version below
Hi ,
Was haben Schneeflocken mit Softwareentwicklung zutun?
Komische Frage. Ich weiß
Aber ich musste sie mir die Tage stellen.
Ich durchforstete den Code.
Ich wollte verstehen welche Connection Pools wir haben und wie sie konfiguriert sind.
Dabei stolperte ich über einen Connection Pool, der hieß: SnowflakeConnectionProviders
Hä?
Was soll das sein? Und wie wird er verwendet?
Und warum ist es eine HashMap<String, IConnectionProvider>
?
Also: Find Usage
und weiterlesen.
Aha, in der init
wird eine kleine pool size konfiguriert. Aber wieso?
In welchem Szenario will ich denn einen connection pool der nur ca 1/6 der verfügbaren cores nutzt? 🤔
Ich konnte den Zweck dahinter nicht erkennen.
Und bevor ich weiter im Dunkeln stocher: Lieber jemanden fragen, statt unnötig Zeit verschwenden.
Also den Dev angerufen, der von der Thematik Ahnung hat.
Und die Erklärung kam sofort: Vor Jahren hat ein wichtiger Kunde verlangt, dass es ein Audit auf die Datenbankqueries geben soll.
Und wie es so oft passiert - man hat es für den einen Kunden eingebaut. Um das zu realisieren brauchte nur dieser Kunde einen anderen User und da der User pro Connection Pool konfiguriert wird musste dieser “Snowflake” eingebaut werden.
Aha!
Da kam also der Name her.
Es ist der leise Protest der Entwickler.
Die wollten die Ausnahme nämlich nicht.
Ich habe neulich schon darüber geschrieben, dass es keine gute Idee ist im Produktgeschäft auf individuelle Kundenwünsche einzugehen. Hier ist so ein Fall.
Zwei Dinge können wir hier lernen:
- Vorsicht mit individuellen Kundenwünschen. Es ist entweder ein Feature, oder won’t happen.
- Benenne deine Variablen und Methoden so, dass sie ihren Zweck beschreiben.
AuditingCustomerConnectionProvider
oder ähnliches hätte mir direkt klar gemacht worum es geht.
In diesem Sinne.
Rule the Backend,
~ Marcus
Hi ,
What do snowflakes have to do with software development?
Strange question, I know.
But I had to ask myself this recently.
I was going through the code.
I wanted to understand which connection pools we have and how they are configured.
That's when I stumbled upon a connection pool named SnowflakeConnectionProviders
.
Huh?
What is that supposed to be? And how is it used?
And why is it a HashMap<String, IConnectionProvider>
?
So: Find Usage
and read on.
Aha, a small pool size is configured in the init
. But why?
In which scenario would I want a connection pool that only uses about 1/6 of the available cores? 🤔
I couldn't grasp its purpose.
And before I grope around in the dark: Better to ask someone instead of wasting unnecessary time.
So, I called the developer who is knowledgeable about this topic.
And the explanation came right away: Years ago, an important client demanded that there be an audit on the database queries.
And as it often happens - it was implemented just for that one customer. To achieve this, only this client needed a different user and since the user is configured per connection pool, this “Snowflake” had to be added.
Aha!
So that's where the name came from.
It's the silent protest of the developers.
They didn't want this exception.
I recently wrote about how it's not a good idea to cater to individual customer requests in the product business. This is one such case.
Two things we can learn from this:
- Be cautious with individual customer requests. It's either a feature, or it won’t happen.
- Name your variables and methods in a way that they describe their purpose.
AuditingCustomerConnectionProvider
or something similar would have made it instantly clear to me what it was about.
On that note.
Rule the Backend,
~ Marcus