Hacker News new | past | comments | ask | show | jobs | submit | Nican's comments login

Yes. SQL is a form of API, and it carries all the same challenges.

-> Permission control, making sure that the user of API can not see data they are not supposed to.

-> Auditability. Verify that the API is being used correctly.

-> Performance. Do not overload the endpoint. (Read from a read replica? And maybe you are not running hour-long analytics queries on the database)

-> Consistency. Are you using transactions to read your data? Could you be causing contention?

-> API versioning. How do you upgrade the underlying tables without breaking the users.


This looks like a good use case for ScyllaDB with Compression and TTL. It is pretty simple to setup a single-node instance.

If you rather have something in-process and writes to disk, to avoid extra infrastructure, I would also recommend RocksDB with Compression and TTL.


As usual, there is a spectrum of data safety vs. performance. Redis is at the "very fast, but unsafe" side of the scale.

ScyllaDB for me is in the middle of being high performance key-value store, but not really supporting transactions. FoundationDB is another one that I would consider.


Depends on the kind of safety you’re looking for. Redis is entirely safe from concurrency issues because it’s single-threaded. It supports an append-only file for persistence to disk.


I have been out of the loop with Java. Is Virtual Threads the answer to asynchronous I/O? (Much like Go/C# async/node.js?)

That looks like an interesting solution to support asynchronous I/O without breaking all the APIs, and having the async/await mess that C# created.


    > ...the async/await mess that C# created
What do you find messy about it? Seems fairly straight forward, IME.


Not sure what the poster above was thinking of, but it seems kinda the same as every other language that’s adopted it - powerful, but footguns abound. I ran some async C# in a debugger - in Rider - the other month, and the debugger just goes off the deep end.

Does C# have the same issue Python does with accidentally calling blocking code? In async Python - which I mostly quite like actually - it’s terrifying to bring in a library because if you’re unlucky it does some blocking network call deep inside that stalls your whole app..


.NET uses threadpool with hill-climbing algorithm. Each worker thread has its own queue and can also perform work stealing. However, if that is not enough and the work queues fill up faster than the items in them get processed, the threadpool will spawn additional threads until the processing lag is counteracted (within reason).

This historically allowed it to take a lot of punishment but also led to many legacy codebases to be really shoddily written in regards to async/await, where it would take some time for threadpool to find the optimal amount of threads to run or devs would just set a really high number of minimum threads, increasing overhead.

In .NET 6, threadpool was rewritten in C# and gained the ability to proactively detect blocked threads outside of hill-climbing algorithms and inject new threads immediately. This made it much more resilient against degenerate patterns like for loop + Task.Run(() => Thread.Sleep(n)). Naturally it is still not ideal - operating system can only manage so many threads, but it is pretty darn foolproof if not the most foolproof amongst all threadpool implementations.

As of today, it is in a really good spot and with tuned hill-climbing and thread blocking detection you would see the .NET processes have thread counts that more or less reflect the nature of the work they are doing (if you don't do any "parallel" work while using async - it will kill most threads, sometimes leaving just two).


    > Does C# have the same issue Python does with accidentally calling blocking code? 
This can't really happen in C# except maybe if you are working on a GUI thread and you make the mistake of running blocking code on a GUI thread.

For APIs, console apps, and such, it's not a concern for actual parallel-concurrent code. Of course, if you write a standard non-parallel `for` loop that has blocking code, it's going to block in a console app as well if you don't run it on a thread.

But I think that once you do enough JS/TS or C#, `async/await` doesn't feel very onerous if you have the basic concept.


Python's async works on a single thread, C# uses a thread pool. Calling a blocking method is not ideal, but doesn't ruin everything, and it's easy to hand that work off to a separate thread by using Task.Run.


Agreed. The task system in C# is pretty clean imo. Same with Rust (sans the type system implementation of Futures) and Go's goroutines. Especially compared to CompletableFuture in Java.


Specifically, function coloring (C# and Rust in your examples) is not the same as coroutines in Go or virtual threads in Java.


Sure function coloring can be a problem, but the gp just spoke about async/await being a mess.

Function coloring can be handled by just blocking on an async function. Though the reverse takes some planning.


> the SQL syntax for selecting a few records is much more verbose than head -n or tail -n

I use DBeaver to inspect SQLite files, and to also work with Postgres databases.

I kind of miss MySQL Workbench, but MySQL is pretty dead to me. And SQL Server Management Studio is a relic that keeps being updated.

I also sometimes make dashboards from SQLite files using Grafana, but the time functions for SQLite are pretty bad.


Could you expand on why the time functions in sqlite are pretty bad?


I am happy using CockroachDB. The performance is not as good, since all your database writes require a 2 out of 3 quorum. But managing the database with the CockroachDB is pretty simple, since it can perform a rolling upgrade with no downtime.

Upgrades is handled with an operator, and happens by waiting all queries to finish, draining all connections, and restarting the pod with the newer version. The application can connect to any pod without any difference.

I perform upgrades twice a year, never really worried about it, and never had any availability problems with the database, even when GCP decides to restart the nodes to update the underlying k8s version.


I first came to learn about the complexity of character sets by finding out that SQL Server's default characterset is 2 bytes per character. I eventually came across Scott's video. UTF-8 encoding is only as new as SQL Server 2019.

https://sqlquantumleap.com/2018/09/28/native-utf-8-support-i...


Careful not to repeat what the University of Minnesota did to the Linux kernel, when willing submitting security bugs to write out a paper about trust.


The duality of HN. I want other people to be forced to filter out bullshit, but I only want to receive forthright submissions myself.


It's really weird. I'm starting to suspect hacker news isn't a single person.


Then why is it called the singular “Hacker” news?


Because there's only one intended reader who is sufficiently educated and smart. All others of us are impostors who should not have pursued this career at all.


If only the Hackers Knew..


No one ever asks Hacker Feels


I'm pretty sure I'm you.


Who am us, anyway?


Yes and no - everyone is just a figment of my imagination.


I thought of the same thing, so I am trying to find information on the documentation about things that CockroachDB does very well:

1. Consistent backups/transactions. When a backup is made, is that a single point in time, or best-effort by individual tablet. For example, backing up an inventory and orders table, the backup could have an older version of inventory, where orders have already been completed for some of them. It looks like Scylla backsup per node, so it could mean that data might have a slight time offset from one another.

2. Replicate reads. Like CockroachDB, it looks like Scylla will redirect the read to the range lead, but CRDB also provides the option to get stale reads from a non-lead. This is usually good for cross-region databases where reading off the lead can be big increases in latency.

I do not have a lot of time, but I am having a hard time finding much information about the architecture on Scylla's documentation. My personal guess is that Scylla optimized their code for performance, and less worry about data integrity.


> My personal guess is that Scylla optimized their code for performance, and less worry about data integrity.

Definitely, but they are implementing Raft-based transactions which provide higher consistency. That should enable a higher variety of use cases.


AI can make you more productive, but it does not make you a better programmer. I am still skeptical about the quality of Copilot, but it has given me good suggestions about how to complete a line, instead of me having to type it all out. But Copilot will also give plenty of wrong or sub-optimal suggestions. You are still required to know what you are doing.

My answer is: "No". You are not hurting your career, but it is still something that could be fun to use.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: