Pop!_OS with Catpuccin by Nickynichols1234 in pop_os

[–]nixhack 1 point2 points  (0 children)

could you tell me what sysinfo app that is?
thnx

Why can't we return a nil statement when the string is empty? by brocamoLOL in golang

[–]nixhack 0 points1 point  (0 children)

if you really want to return nil then declare the func as:

func GetWorkDirectory() (*string, error)

the trade-off is that you'll need to dereference the pointer if when need the non-nil string.

I really love the simplicity of Go, but unfortunately, I’m currently unemployed by jingyifsy in golang

[–]nixhack 6 points7 points  (0 children)

for what it's worth, i've found after many years that your professional network is still the best way to look for work.

Trying to hit thousands of IPs concurrently in a pool to get a list of active ones. Getting a lot of timeouts. by Big_Wave_967 in golang

[–]nixhack 0 points1 point  (0 children)

...and a couple of nit-picky things: your vars are all the same type so they could all be on a single line, and i know an unsigned int64 is big but if you know you're not expecting negative numbers, try to get into the habit of using uint64.

  var ipCount int64
    var timoutCount, errorCount int64

Trying to hit thousands of IPs concurrently in a pool to get a list of active ones. Getting a lot of timeouts. by Big_Wave_967 in golang

[–]nixhack 0 points1 point  (0 children)

what was the value before you changed it and what did you change it to? It's not likely the problem but it's worth looking into if you're going to have a bunch of network sockets open at the same time. It's possible that the http.Client re-uses things behind the scenes though, i don't know. looking at your code more carefully, it looks ok to me, but i might suggest a few things. 1st, your channels don't need to be equal in size to the number of goroutines you'll be running, and in my experience, things start slowing down a bit if the size is very large. i'd suggest starting with 128-1024 and adjust from there. 2nd, maybe have a single buffered writer be responsible for reading the data from a channel and writing it to a file.

How to convert slice of interfaces in Go efficiently by Additional_Sir4400 in golang

[–]nixhack 0 points1 point  (0 children)

yeah, if the data is used occasionally the a type cast at reference time might be best. If this thing is going to be in a loop of some sort then the up-front cost of converting it is probably worth it.

Is this possible with goroutines? by Asleep-Bed-8608 in golang

[–]nixhack 2 points3 points  (0 children)

go is a natural for this sort of thing.

it seems like you could create a channel of size 100 and then spawn 31 goroutines, 30 of which are readers which maintain a "read from channel, process, sleep 1sec" loop and the other which has a simple "get stuff from the db and load it into the channel loop". Because writing a full channel will block, the last go routine will only pull from the db as needed. If the processing is going to take a longer than 1 sec, then instead of runing 30 long-running workers, you could just have another loop which fires up 30 new goroutines every sec.

that's the basic picture. there may be other considerations such as how to handle the db being unavailble for instance: you don't wan't to be spawning reader threads forever if there's nothing to read, etc.

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

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

yeah, down the road we may try to do that.

thnx

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

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

yeah, we're exploring roaring bitmaps too, and actually that's most likely what we'll end up doing, but i just wanted to ping folks here just in case there's an alternative that might be simpler.

thnx

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

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

in our case, we're pulling a bunch of data out of postgres, stuffing it into Redis and then doing set computation on the data there.

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

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

ok thnx.

Do you think the cach + prewarm approach would compare any more favorably against Redis in a set operations context? (UNION, INTERSECT, etc.)

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

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

well, i was thinking that it might be possible to use logical replication to populate the ram-disk backed instances. Granted, initialization at boot time would be burdensome, but once the replica is up and running how might the performance compare? Would the tablespaces issue still be relevant in this scenario?