CatOps
5.68K subscribers
94 photos
4 videos
19 files
2.27K links
DevOps and other issues by Yurii Rochniak (@grem1in) - SRE @ Preply && Maksym Vlasov (@MaxymVlasov) - Engineer @ Star. Opinions on our own.

We do not post ads including event announcements. Please, do not bother us with such requests!
Download Telegram
Handling concurrency is hard, even if it was made simple.

The Go 1.19 Atomic Wrappers and why to use them explores the sync/atomic package which was introduced in Go 1.19 and use cases for it.

I haven't used this one personally, but we have sync.Map in one of the projects to get the results from goroutines in one place.

#go #programming
Dead simple method of profiling your Go applications.

tl;dr:
- Import the github.com/pkg/profile package
- Add defer profile.Start().Stop() into your main function for CPU profile
- Add defer profile.Start(profile.MemProfile).Stop() for memory profile

#programming #golang
Avoiding Pitfalls in Go is a good article for those who just starts their journey with this language.

Yet, there are some aspects that are useful even if you use it already. Especially, if your use cases were limited to some simple code.

#programming #go
Bounded channels is a common way of limiting the concurrency in Go applications.

From this article you can learn some theory behind this approach as well as about the sync/semaphore package. I didn’t know about the latter.

#programming #go
I think I have posted something like this before, but anyway...

Here's a two part story of how to optimize memory usage of a Go application just by reshuffling fields in structs.

Part one provides some theory on this matter, while part two has some benchmarking results.

I'm not trying to say that you should run and reshuffle fields in all your Go structs right now. Especially, if you're satisfied with the memory consumption of your app - sometimes it makes sense to optimize for readability or just store pointers in structs.

However, these articles describe some details of how memory allocation works in Go, which you may find interesting.

#programming #go
An opinionated article that claims that one has to keep all the dependencies in version control.

Now, I don’t have strong opinions here. On one hand the proposal in this article sounds extreme. On another hand, my team has quite a few Go projects and we use vendored modules there.

So, we actually keep the dependencies in VCS. As anything else, it has its pros and cons. I could build a project and run some isolated tests on a plane. But also it almost impossible to review a PR that touches that vendor/ directory.

The author points out that it’s Git’s fault that it’s not designed to work with large number of files and files of a large size. Yes, I’d ask for a reality check here, some Git is omnipresent these days.

#programming #git #opinion
​​There was an interesting talk at CfgMgmtCamp 2024 about non blocking code reviews.

The good thing is that there’s also an article on this topic from the author

The general idea is that not all the code changes require a code review, especially when there are enough safety nets configured.

As a result, smaller code changes simply sit there and wait for be reviewed, which may take some time, especially in a remote setup.

The solution is to allow such changes as they are and add them to a backlog of pending reviews.

There are more details in the article. Also, here’s a picture from that presentation that kinda captures the spirit of this idea.

#programming #culture #devops
Ruby was the first programming language I tried to consciously learn. Meaning, it wasn't a part of a university curriculum or something.

Despite not using it for many years, I still have some warm feelings towards this language. In this article Lucas Seiki Oshiro argues that Ruby is good for shell scripts as well.

Ruby is strongly associated with the Rails framework. So, I think this article is a good reminder that programming languages are more than just frameworks.

#programming #ruby
Amazing Julia Evans posts about the things she missed in Go.

This is kinda a promotion of the book "100 Go Mistakes and How to Avoid Them" and you know what, now I want to read it!

P.S. Unfortunately, I don't have a chance to write much in Go lately, which makes me sad. Maybe, it will push me towards creating some side-projects, probably, someday, maybe 😭

#programming #golang
Some people know that I'm not a fan of Python. Yet, I have to tolerate it because it is objectively one of the most popular and widespread programming languages.

So, here is an article about asynchronous code in Python.

Enjoy!

#programming #python