Homayoon Alimohammadi (@HomayoonAlm) profile picture

Software Engineer - Trying to figure things out one step at a time.

Dubai, UAE
Joined May 2022
Photo by Homayoon Alimohammadi (@HomayoonAlm)Photo by Homayoon Alimohammadi (@HomayoonAlm)
Homayoon Alimohammadi retweeted
امیدوارم تا حوصله‌شو داری، بشه.
56
302
13
5,561
104,791
Homayoon Alimohammadi retweeted
(Retweets hugely appreciated) Today I'm proud to announce the launch of my first self-published book Foundations of Debugging for Golang Being able to debug locally and in production is a critical skill for any #golang engineer, but it is rarely taught explicitly. It has taken me many years of working with Go in production to get comfortable debugging, and I want to accelerate your learning by teaching you everything I wish I had known when I started out. What You'll Learn 👉 How to get better at spotting issues by eye. 👉 Logging patterns and how to build an enterprise logging strategy. 👉 What are metrics, how to create them and how to build great dashboards. 👉 What distributed tracing is, and how to set it up in your company. 👉 How to use Go's profiling tools to debug performance issues use and squeeze every ounce of performance out of your application. For this week only, you can get $10 off using this link: bytesizego.com/the-ultimate-… I can't wait to hear what you think :)
17
139
9
520
7,404,077
Homayoon Alimohammadi retweeted
its official; #golang twitter loves sqlc! What is it? sqlc generates type-safe code from SQL. - You write queries in SQL. - You run sqlc to generate code with type-safe interfaces to those queries. - You write application code that calls the generated code. Here's an example. For an input of: You get type safe Go code such as: Powerful! What are the downsides? - some folks really do not like code-generation. I sort of get this, but this seems a great use case. - Some folks such as @xeros78 reported limitations such as "in some cases, it doesn't support count(*) as X but it works with count(id) ... Also scoped query is not supported (ex: adding a where on a query) which can be blocking on some projects." If you want to check it out, I'll link some further reading below.
14
17
2
156
31,949
Homayoon Alimohammadi retweeted
چند وقت پیش یه کدی که 8 سال پیش زده بودم به شدت کند شده بود و یکی از فرایند های زنده کردنش رو تبدیل کردم به یک مقاله که یک تجربه ساده ولی گوگولی ایی رو توضیح میدم :)) به شکل خلاصه composite index ها رو یاد میگیریم. medium.com/@mhrlife/reviving…
1
2
23
1,416
Homayoon Alimohammadi retweeted
It is important to have enough data to be statistically significant, but it is also crucial to ensure a targeted focus and not choose a generic global user. This approach could lead us to produce results based on global users, but these could differ if we tested on local users.
Replying to @bandanjot
Your experiment should have enough "power" to give conclusive results. You can achieve"power" through i) High # of users (per day) in base & variant ii) Increasing the run-time of experiment iii) Use a conclusive criteria that is not too ambitious but nor too easy to meet (4/5)
1
1
479
Homayoon Alimohammadi retweeted
I'm going to follow up on this one today with and answer some of the questions that came up: How long does singleflight cache for?/ How do I remove a key? The singleflight package in Go does not have support for key expiration. Its primary purpose is to prevent multiple goroutines from executing duplicate functions concurrently. However, it does have a "forget" function. You could schedule forgetting a key as a means to expire a cache. Here's a naive example: What if I'm using channels? The DoChan method in the singleflight package is a variation of the Do method, but instead of waiting for the call to finish and returning the results, it returns a channel immediately. You can then use this channel to receive the results asynchronously. Here's a simple example of that: Between this tweet and the one yesterday, we have covered every function of the singleflight package. Simple, succinct and powerful!
Singleflight Singleflight is a really interesting package that "provides a duplicate function call suppression mechanism." Why use singleflight? Consider an application that fetches data from an API or a database (i.e, pretty much any application in existence). If several requests trigger the same call, this might trigger multiple identical database or API calls. These redundant requests can strain your system, leading to wasted CPU cycles, memory, and bandwidth. By using singleflight, we can remove these duplicate calls really easily. Here's an example: In this example, even though we have 5 goroutines simultaneously requesting data for the same key, the fetchData function will only be called once due to the group.Do function from singleflight. Do you use singleflight? what for?
4
8
63
16,572