software-architecture
software-architecture
software-architecture
How to correctly order messages in distributed systems
Message ordering in distributed systems does not come from a FIFO queue. What actually keeps events sane: idempotency as the real safety net, partition keys when order truly matters, optimistic locking as a version guard, and the traps of multiple consumers.
ruby-on-rails
Structured logging in Rails 8.1 with Rails.event
Structured logging lands in Rails 8.1 with the Rails.event API. How the Structured Event Reporter replaces regex-parsed log lines with JSON events, plus tags, context, schemas, debug mode, and how to subscribe and test events in your own app.
Latest
Ruby 4.0 - a big update for its 30th birthday
Ruby 4.0 marks the language's 30th birthday with maturity instead of revolution: saner syntax for multiline conditions, faster boot with fewer requires, a maturing Ractor story, hidden performance gems, and protection against command injection.
PostgreSQL and lock timeout issues – how to deal with them also in Ruby on Rails?
PostgreSQL lock timeouts strike during long migrations and complex transactions. How lock_timeout and statement_timeout actually work, quick fixes at the database role level, managing timeouts in Rails migrations, and global protection with StrongMigrations.
How can I check the size of the database and tables in PostgreSQL?
PostgreSQL database size checks in a few simple SQL queries: list all databases with pg_database and pg_size_pretty, then break down the biggest tables in a schema, indexes included. Spot what eats disk space before it slows backups and raises infrastructure costs.
How to effectively manage and terminate old PostgreSQL connections
Idle PostgreSQL connections eat memory and can hit the max_connections limit, blocking your app. How to find old sessions in pg_stat_activity, close them safely with pg_terminate_backend, and automate the cleanup so hanging connections never pile up again.
Powerful switch statement with pattern matching in Ruby
Pattern matching in Ruby turns case statements into a precise switch over data shapes: match and destructure hashes from an API response, combine several patterns in one branch, capture values across patterns, and validate configuration. Ruby 2.7+ syntax examples.
Multiple ways to execute a shell command via Ruby
Running shell commands from Ruby: system, backticks, exec, the IO class, spawn, and Open3.popen3 compared with pros and cons, from quick one-liners to capturing stdout, stderr, and exit status, so you can pick the right method for scripts and production code.
Solutions to paginate data in your databse and which one is the best
Database pagination goes beyond LIMIT and OFFSET: ROW_NUMBER(), the FETCH clause, and keyset pagination each behave differently as tables grow. SQL examples for every approach, why offsets get slow on big datasets, and a verdict on which method scales best.
Database shrading and database partitioning in Rails
Database sharding in Rails step by step: create a separate database per shard, wire them up in database.yml, and query across them. Plus how sharding differs from partitioning, with a native PostgreSQL partitioning example done through Rails migrations.
Rails optimistic locking, pessimistic locking and how to solve StaleObjectError
Rails locking strategies for concurrent updates: optimistic locking with a lock_version column that works out of the box, pessimistic locking with lock! and with_lock, and practical ways to rescue and resolve the StaleObjectError that optimistic locking raises.
Differences between load, autoload, require, and require_relative in Ruby
Ruby has four ways to load code and each behaves differently: load re-executes a file every time, autoload waits until first use, require loads once from the load path, require_relative resolves from the current file. Examples plus a summary of when to use each.
Ruby in browser via WebAssembly
Ruby 3.2 runs in the browser through WebAssembly: embed Ruby in a script tag with ruby-wasm-wasi or drive the Ruby VM from JavaScript and mix it with HTML. Working examples plus honest limits: no threading or networking, and no extra gems without a custom wasm image.