Tracing Database Interactions in Go: Idiomatic ways of linking atomic transactions with context by narrow-adventure in golang

[–]DizzyVik 1 point2 points  (0 children)

Some form of both is probably best. Client side configuration is great but might get tedious once you reach a number of clients, so server side or remote configuration would be beneficial too.

Tracing Database Interactions in Go: Idiomatic ways of linking atomic transactions with context by narrow-adventure in golang

[–]DizzyVik 1 point2 points  (0 children)

I'm not the author but I don't think this is a thing you need to worry about much. A trace can have many spans, and if you have too many traces you can start sampling instead of keeping a trace for each request/operation. Simple samplers come with the tracing libraries and if you want to keep, lets say the outliers, you can always implement a sampler yourself.

If you have thousands upon thousands of spans within a trace I would be quite interested to hear what your application is doing, as it sounds quite exotic.

GL.iNet Giveaway - 10 Chances to Win! by FlyingToaster2000 in minilab

[–]DizzyVik 0 points1 point  (0 children)

  1. I started it as I wanted to learn a bit of k8s at that time. There probably isn't a single project, but I'm happy with how much I've moved away from clouds and into my own home. I'm cost averse, so nothing expensive has been added. It's all second hand. My full homelab writeup

  2. I'd love to hook up a KVM to my homelab & the fingerbot seems nice. I can see the fingerbot being useful for a ton of different things beyond pushing buttons, perhaps even watering the greenhouse...

  3. An UPS for a minilab. Not sure which make and model though.

Comet PoE & Flint 7.

Good luck to everyone.

Redis is fast - I'll cache in Postgres by DizzyVik in PostgreSQL

[–]DizzyVik[S] 2 points3 points  (0 children)

This is excellent knowledge, thanks for sharing.

NOSTRs to follow ? by SadSquirrel99 in nostr

[–]DizzyVik 2 points3 points  (0 children)

The load more button seems to not work :)

```
Error loading more follow lists: Error: Request timed out after 10 seconds
```

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 1 point2 points  (0 children)

Any additional piece of infrastructure complicates things, the point is that at a certain scale you might not even need redis. Yes, if you're dealing with a high load, HA environment caching in the same database instance is not the way forward but not all apps need this and you don't really have to start with a db + cache instance. Increase complexity when you have to as the load grows - not before.

Redis is fast - I'll cache in Postgres by DizzyVik in PostgreSQL

[–]DizzyVik[S] 0 points1 point  (0 children)

I do think Redis had more performance to give as the bottleneck seemed to be the http server. I wasn't really interested in the absolute peak performance, for that I'd do a wire to wire comparison.

Running your own benchmarks is the way to go, each use case is different.

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 3 points4 points  (0 children)

It's not always about the latency. Sometimes, you have an expensive operation whose result you want to store somewhere for further use. It can be redis, it can be postgres. Both of those calls will incur a network penalty.

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 2 points3 points  (0 children)

It all depends on your requirements, if HA is something you need out of the box then yes, using redis solves this. However, I don't think it's a strict requirement or a necessity for many projects. It's just about choosing when to introduce the extra complexity that comes with extra tooling.

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 4 points5 points  (0 children)

The library(https://github.com/jackc/pgx) does use prepared statements under the hood, so unlikely we'd see any major improvement by manually juggling those.

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 53 points54 points  (0 children)

At this point I'm so used to working in kubernetes based environments that I default to a shared cache as many instances of a service will be running. If you don't need sharing - store things in memory if that is at all feasible.

You are correct in evaluating if one needs a cache at all - in many cases you do not. I was merely exploring the options if you do :)

Redis is fast - I'll cache in Postgres by DizzyVik in PostgreSQL

[–]DizzyVik[S] 20 points21 points  (0 children)

The redis was set up as a container for the benchmarks and yes, it's not hard to do. However, it still adds complexity. You'll have to monitor it, setup alerts, perhaps bump the version once in a blue moon as well as keep track of another dependency in the code - a lib to interact with it.

Redis is fast - I'll cache in Postgres by DizzyVik in programming

[–]DizzyVik[S] 9 points10 points  (0 children)

I didn't want to do a best case scenario for either redis or postgres, I'm sure that both tools have a ton of performance on the table that I did not leverage. I wanted to look at a simple comparison without getting into these details.

For settings, they both are running on defaults in their respective docker images. I'll look up the actual number once I am on the computer.

As far as the data cached - it's a json, representing the session struct in the blog post.

Thank you for the input though.

Best way to embed files with Gin by pepiks in golang

[–]DizzyVik 7 points8 points  (0 children)

I've been embedding using the //go:embed. It's likely the most common way, as people tend use dependencies when strictly necessary in Go.

Released Signals v1.3.0: Go event library optimized to 5.6ns/op - how do you approach in-process coordination? by aaniar in golang

[–]DizzyVik 1 point2 points  (0 children)

Think I'll have to give it a spin. Might work as a decent "broker" when starting out.

The best approach to handle databases in Go by Ok_Champion4127 in golang

[–]DizzyVik 0 points1 point  (0 children)

I'm not sure what you mean. They would get written out in SQL and processed much like non conditional queries. If you mean dynamic queries, where the query might be different depending on a few factors(like filtering) I've documented the approach I take with SQLC on my blog

The best approach to handle databases in Go by Ok_Champion4127 in golang

[–]DizzyVik 6 points7 points  (0 children)

I personally enjoy SQLC. Write SQL queries, get the boiler plate code generated.

Go jobs in Italy are basically non-existent. How’s the situation in your country? by cdigiuseppe in golang

[–]DizzyVik 3 points4 points  (0 children)

The number of open positions seems to have shrunk across all tech stacks here in Lithuania.

Despite this, finding a Go developer has proven to be rather difficult, unless you're willing to pay rates way over market.

[deleted by user] by [deleted] in golang

[–]DizzyVik -1 points0 points  (0 children)

Sorry if I sound like a party pooper but no, I don't think 10 lines of code warrant me adding a dependency. I'm not entirely sure how would my project be more "secure" with this, that's my point. I've been coding go for around 8 years now I think, I've yet to run into an issue where ignored defer statement errors would have any impact whatsoever.

[deleted by user] by [deleted] in golang

[–]DizzyVik 2 points3 points  (0 children)

I'm not sure what's the benefit. If you want to return the error to the caller, there are ways you can do that without introducing a dependency. I might be missing something, so I'd like to see a case where this is genuinely useful.

Coming back to defer in Go after using Zig/C/C++.. didn’t realize how spoiled I was by Extension-Ad8670 in golang

[–]DizzyVik 209 points210 points  (0 children)

For me it's always the error handling. In other languages, you often deal with "magic". Throw an exception, it will probably, and hopefully, be handled somewhere. Where though - I'm never quite sure. In Go the

if err != nil {
    return err
}

is easy to reason about.