27 Kasım 2026 Cuma

Sharding

Kaç Tane Shard Olmalı
Açıklaması şöyle. Yani shard sayısı artan bilgisayar sayısı ile uyumlu olmalı
One of my favourite system design questions:

Notion split its Postgres database into 480 shards.
Why 480? Why not 500, or a nice round 512?

I saw this question on X this week and most answers said "performance". It's not really about performance.

480 can be divided evenly by a lot of numbers. 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 30, 32, 40, 48, 60 and more.

The shards are logical. The machines are physical. You fix the number of shards once, but the number of machines keeps changing as you grow. So you want a shard count that splits evenly across whatever machine count you might need later.

In 2021 Notion ran the 480 shards on 32 machines. 15 shards each.
In 2023 they needed more room and moved to 96 machines. 5 shards each. Every machine got the same share and the total stayed 480.

Now try the same with 512. 512 only divides evenly by powers of two. 32 machines is fine, 64 is fine, 96 gives you 5.33. Some machines carry 6 shards, some carry 5, and the busiest one decides how the whole thing feels.

A number someone picked in 2021 made their 2023 migration a lot simpler. I really like that kind of decision.

26 Kasım 2026 Perşembe

Microsoft Garnet

Giriş
C# ile geliştirilmiş.

Açıklaması şöyle
Garnet doesn’t shard the keyspace across threads. Instead, every network session runs completely independently (shared-nothing) but all of those sessions read and write into one single, shared data store underneath. There’s no partitioning, no routing layer, no re-collation of responses. A batch of commands arriving on one connection gets executed start to finish by whichever thread picked up that packet, with zero thread-switching in between.
Tsavorite 
Açıklaması şöyle
he reason this doesn’t turn into a lock-contention mess is the storage engine underneath, called Tsavorite (a lighter-colored gemstone in the garnet family, the naming theme is consistent, at least). Instead of exposing 250+ different operations, Tsavorite exposes exactly five: Read, Upsert, Modify, Delete, Scan, called RUMDS. Every Redis-style command gets built out of these five basic moves plus a small bit of custom logic (a “callback”) layered on top. GET is a Read with a callback that copies bytes into the response. INCRBY (increment a number) is a Modify with a callback that does the math in-place if there’s room, or allocates a bit more space and copies over if the number grew an extra digit. LPUSH (push onto a list) on a key that doesn’t exist yet triggers a callback that allocates a brand new list.

19 Kasım 2026 Perşembe

Checkout Sayfası ve Caching

Giriş
Açıklaması şöyle
Postgres says the price is 4.99.
Redis says it is 5.49.
What does the customer see?

"Neither. Postgres and Redis should never disagree. That is why I update both in one distributed transaction."

It sounds rigorous, but nobody runs it.

Redis cannot join a two-phase commit. And even if it could, every price change would now wait on two systems, and fail when either one is down.

So what do teams actually do?

1. The price change commits in Postgres first. Only after the commit, the service deletes that product's key in Redis. This happens outside the Postgres transaction.

2. If the delete fails, it retries. If it still fails, the key's TTL puts a limit on how long the old price can live.

3. Some teams send the invalidation as an event instead, read from the database's change log. Nothing gets lost that way, but it is one more component to run.

Either way, for a short window, the two prices can disagree.

And that is fine. Because the price on the product page is not the price the customer pays.

When they add it to the cart and check out, the price is read from Postgres. If it changed, they see the new one before they pay. You have seen this on shopping sites: one price on the listing, a "price updated" note in the cart.

So the design question is not "how do I keep them in sync?"

It is "where does the price have to be exactly right?"

The product page can be a few seconds behind.
The checkout cannot.

In a design round, deciding where the data has to be exactly right is a step 1 decision, not a step 4 detail. I have a playbook with all 6 steps, the minutes for each, and the 4 traps that make people freeze.

11 Kasım 2026 Çarşamba

DMR (Digital Mobile Radio) CSBK Notlarım

CSBK - Control Signalling Block
Bazı notlarım aşağıda

CSBK Adresleri
Bir CSBK mesajı şu hedeflere adreslenebilir
A specific radio (Individual ID)
A talkgroup (Group ID)
All radios (Broadcast)
A subset of radios depending on the CSBK type
DMR 24-bit adresler kullanır. Bazı özel adresler şöyle
0xFFFFFF (16777215) All Radios / Broadcast / All Call
0xFFFFFE (16777214) Reserved special address
0x000000 Often used as Null Address depending on context
CSBK Header
4 kısımda oluşur
1. lastBlock - 1 bit
2. protectedFlag - 1 bit
3. opCode - 6 bit
4. featureId (manufacturer)- 8 bit. Açıklaması şöyle
Also note that ETSI defines a second level of grouping through the FID (Feature ID) field. The same CSBKO value can have different meanings depending on the FID. ETSI reserves FIDs for standard features and manufacturer-specific features.
Ahoy Message

Value Service Kind Description
0x0Individual Voice CallIndividual voice call
0x1Talkgroup Voice CallTalkgroup voice call
0x2Individual Packet DataIndividual packet data service
0x3Talkgroup Packet DataTalkgroup packet data service
0x4Individual Short DataIndividual short data service
0x5Talkgroup Short DataTalkgroup short data service
0x6Short Data PollingPoll for short data
0x7Status TransportStatus transport service
0x8Call DiversionCall diversion
0x9Call AnswerAnswer an incoming call
0xA–0xCReservedReserved values
0xDSupplementary ServiceSupplementary service
0xERegistration / Authentication / Radio CheckRegistration, authentication or radio check
0xFCancel CallCancel an existing call

UDT (Unified Data Transport)
Açıklaması şöyle
UDT (Unified Data Transport) is used in DMR to transfer short data messages between radios or between a radio and an application/system.

Typical use cases
1. Text messages between radios.
2. GPS/location information (NMEA).
3. Predefined status information.
4. Binary application data.
5. Address or identification information.

10 Kasım 2026 Salı

ACID - Write Skew

Write Skew Nedir ?
İki farkı satırım değiştirilmesi sonucunda olmaması gereken bir noktaya varmaktir.

Açıklaması şöyle
Imagine you’re building a hospital management system.

The hospital has two doctors on call. Either doctor can request time off, but the system must always ensure at least one doctor remains available.

The business rule sounds simple: At least one doctor must remain on call at all times.

Now imagine both doctors request time off at almost exactly the same moment. Doctor A checks the database and sees two active doctors. Doctor B performs the same check and also sees two active doctors. Both conclude that taking time off is safe. Doctor A updates their status to OFF_DUTY. Doctor B does the same.

Both transactions commit successfully.

What does the database contain now?

Zero doctors are on call.

Neither transaction violated the rule as conflict isn’t between two writes to the same row. Both transactions executed successfully. Yet the final database state violates an important business constraint.

This is called Write Skew, and it exposes an important limitation of Snapshot Isolation.
Örnek - Postgres
Açıklaması şöyle
PostgreSQL's SERIALIZABLE isolation level prevents write skew.

PostgreSQL's Serializable Snapshot Isolation (SSI) detects dangerous dependency cycles that could produce non-serializable results.

For example:
1. Two doctors are on call.
2. Each transaction checks that at least two doctors are on call.
3. Transaction A takes doctor 1 off call.
4. Transaction B takes doctor 2 off call.
5. Both transactions attempt to commit.
Under REPEATABLE READ, both transactions can commit, leaving zero doctors on call.

Under PostgreSQL SERIALIZABLE, PostgreSQL detects the conflict and aborts at least one transaction.

Important: You must retry the entire aborted transaction when PostgreSQL returns SQLSTATE 40001.

So, if you need protection against write skew, PostgreSQL SERIALIZABLE is the appropriate isolation level.
Örnek - SqlServer
Açıklaması şöyle
In SQL Server, SERIALIZABLE prevents write skew.
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

BEGIN TRANSACTION;

-- Read and update data

COMMIT;


Unlike PostgreSQL SSI, SQL Server primarily achieves this through locking, including key-range locks.
Database Serializable implementation
PostgreSQL SSI (conflict detection)
SQL Server Locking and key-range locks

Important: SQL Server's SNAPSHOT isolation does not prevent write skew. It can allow two transactions to update different rows based on the same initial state.

For your SQL Server applications, use SERIALIZABLE when you need this guarantee, or consider explicit UPDLOCK, HOLDLOCK when you want more targeted locking.

Lost Update vs Write Skew
Örnek
Bir örnek şöyle
Case 3: Consider your team is on production support for a week. The requirement is at least 1 person should always be on support. Is it possible that if you and teammate try to unassign themselves (assuming the other one is still available) then no one is on support ?
Hatalı kod şöyle
## Psuedo code
if(totalMembersOnSupport() > 1) {
  removeFromSupport(user_id);
}
totalMembersOnSupport() -> Select count(user_id) from support where on_support = 't';
removeFromSupport() -> update support set on_support = 'f' where user_id = '234';
Açıklaması şöyle. Yani her iki kullanıcı bir sayaca bakarak kendi satırlarına güncelleme yapıyorlar.
One difference between this case and the previously discussed cases is that in the previous cases concurrent transactions were trying to update the same row. But in this case, they are updating two different rows.
This is known as Write Skew


13 Ekim 2026 Salı

SSRF - Server-Side Request Forgery

Giriş
Dışarıya bakan bir REST noktamız var. Bu nokta şöyle olsum
@RestController
@RequestMapping("/preview")
class PreviewController {

    private final RestClient restClient;

    PreviewController(RestClient.Builder builder) {
        this.restClient = builder.build();
    }

    @GetMapping
    String preview(@RequestParam URI url) {
        return restClient.get()
                .uri(url)
                .retrieve()
                .body(String.class);
    }
}
Eğer saldırgan URL olarak içsel/dahili bir adres verirse, butün güvenlik önlemlerini aşabilir. 

Spring Boot 4.1.1 bunu önlemek için org.springframework.boot.http.client.InetAddressFilter; sınıfını sağlıyor. Böylece restClient başka bir adrese bağlanamaz.

CRDTs - Conflict-Free Replicated Data Types

Giriş
Conflict-free replicated data types( CRDTs) are a family of data structures for sets, maps, ordered lists, counters, etc that can be concurrently edited by multiple users. It uses two-way merges.
İlgili bir yazı burada
Örnek
Şöyle olsun
import java.util.Objects;

public record ReplicaId(String value) {
    public ReplicaId {
        if (value == null || value.isBlank()) {
            throw new IllegalArgumentException("Replica ID must not be blank");
        }
    }
}
Şöyle olsun
public sealed interface CounterCommand
        permits CounterCommand.Increment, CounterCommand.Decrement {
    ReplicaId replica();
    record Increment(ReplicaId replica) implements CounterCommand {
        public Increment {
            java.util.Objects.requireNonNull(replica);
        }
    }
    record Decrement(ReplicaId replica) implements CounterCommand {
        public Decrement {
            java.util.Objects.requireNonNull(replica);
        }
    }
}
Gerçekleştirim şöyle.
Instead of storing one mutable total, it stores two maps:
- positive: the cumulative increments made by each replica.
- negative: the cumulative decrements made by each replica.
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public record PnCounter(
        Map<ReplicaId, Long> positive,
        Map<ReplicaId, Long> negative) {

    public PnCounter {
        positive = immutableNonNegative(positive);
        negative = immutableNonNegative(negative);
    }

    public static PnCounter empty() {
        return new PnCounter(Map.of(), Map.of());
    }

    public PnCounter apply(CounterCommand command) {
        Objects.requireNonNull(command);

        return switch (command) {
            case CounterCommand.Increment inc ->
                    new PnCounter(bump(positive, inc.replica()), negative);
            case CounterCommand.Decrement dec ->
                    new PnCounter(positive, bump(negative, dec.replica()));
        };
    }

    public PnCounter merge(PnCounter other) {
        Objects.requireNonNull(other);
        return new PnCounter(
                joinByMaximum(positive, other.positive),
                joinByMaximum(negative, other.negative));
    }

    public long value() {
        return Math.subtractExact(sum(positive), sum(negative));
    }

    private static Map<ReplicaId, Long> bump(
            Map<ReplicaId, Long> current,
            ReplicaId replica) {

        var next = new HashMap<>(current);
        next.merge(replica, 1L, Math::addExact);
        return Map.copyOf(next);
    }

    private static Map<ReplicaId, Long> joinByMaximum(
            Map<ReplicaId, Long> left,
            Map<ReplicaId, Long> right) {

        var merged = new HashMap<>(left);
        right.forEach((replica, count) ->
                merged.merge(replica, count, Math::max));
        return Map.copyOf(merged);
    }

    private static long sum(Map<ReplicaId, Long> components) {
        return components.values().stream()
                .mapToLong(Long::longValue)
                .reduce(0L, Math::addExact);
    }

    private static Map<ReplicaId, Long> immutableNonNegative(
            Map<ReplicaId, Long> source) {

        Objects.requireNonNull(source);
        Map<ReplicaId, Long> copy = Map.copyOf(source);
        copy.forEach((replica, count) -> {
            Objects.requireNonNull(replica);
            if (count < 0) {
                throw new IllegalArgumentException("Components must be non-negative");
            }
        });
        return copy;
    }
}


9 Ekim 2026 Cuma

Metamorphic Testing

Giriş
Konuyu ilk defa burada gördüm.
Traditional testing assumes you know the expected output.

assertEquals(4, calculator.add(2, 2));

But how do you test an LLM that generates open-ended answers when there is no single correct output?

This is called the oracle problem: determining whether a program's output is correct when the expected answer is difficult or impossible to establish.

Metamorphic testing addresses this by checking relationships between multiple executions instead of checking each output against a known answer.
Örnek
How metamorphic testing works

The key concept is a metamorphic relation (MR): a property that should remain true when you transform an input and execute the system again.

1. Original input

A woman is sitting on a park bench with her dog.

Paraphrase without changing meaning

2. Transformed input

A woman sits outdoors with her pet nearby.

Run both inputs through the LLM

Same classification : Relation holds

Different classification : Potential fault

The important point is that you don't need to know the correct classification in advance. If two semantically equivalent inputs produce contradictory classifications, the model may be behaving inconsistently. 

8 Ekim 2026 Perşembe

TCP Bottleneck Bandwidth and Round-trip propagation time (BBR)

1. Flow control — protects the receiver
Flow control = don't overwhelm the receiver.

2. Congestion control — protects the network
Even if the receiver can accept 1 GB/s, the network path might only handle 100 MB/s.

3. BBR — a different approach to congestion control
BBR changes the question.

Instead of primarily asking:
"Did I lose packets?"

it measures:
- Bandwidth
- RTT (latency)

and estimates the network's BDP (Bandwidth × RTT).

Then it tries to keep approximately the right amount of data in flight to utilize the available bandwidth without unnecessarily filling network buffers.

CUBIC ve BBR

CUBIC:
send faster
   ↓
packet loss
   ↓
slow down
   ↓
increase again
   ↓
loss
   ↓
slow down
BBR:
measure bandwidth + RTT
          ↓
estimate capacity
          ↓
send near that rate
          ↓
continuously measure again

ETL (Extract Transform Load) Pipeline

1. ETL Pipeline ne zaman lazım olur ?
- Bir projeyi ilk defa ayağa kaldırırken mevcut veriyi alıp kendi veri modelimize çevirirken kullanırız.

- Çalışan bir başka sistemin değişen deltasını alıp kendi sistemimize ekleyerek, senkronizasyonu sağlamak amaçlı kullanabiliriz.

- Data warehouse sistemini çeşitli kaynakları kullanarak beslemek için kullanabiliriz.

2. ELED Extract–Load–Eligibility-Deliver Pipeline
Aslında delivery pipeline demek daha doğru. ELED benim kendi uydurmam. Açıklaması şöyle
An ELD (Extract–Load–Deliver) delivery pipeline with eligibility, acknowledgment, retry, and penalty processing.
Burada
  • Extract = obtain candidate work from the source.
    • Read pending transmission records from DB
    • Receive new transmission requests
    • Fetch configuration/parameters needed to decide eligibility
  • Load = bring that work into the dispatcher's working set.
    • Put records into the actor's queue/buffer
    • Restore pending/in-flight state
    • Build the in-memory transmission items
  • Eligibility = decide what can be transmitted now.
    • Is it enabled?
    • Is the penalty expired?
    • Is the destination available?
    • Is the item within its transmission window?
    • Has it already been sent/in-flight?
  • Deliver = actually perform reliable transmission.
    • Send
    • Wait for ACK
    • Retry
    • Apply penalty
    • Complete/remove the item


    6 Ekim 2026 Salı

    Invariant nedir

    Giriş
    Açıklaması şöyle
    An invariant is not documentation describing what usually happens. It is a condition that must remain true across every valid transition in the system.
    Örnek
    Available + reserved= total inventory 

    30 Eylül 2026 Çarşamba

    JSON Çeşitleri

    Giriş
    Açıklaması şöyle
    There's a whole ecosystem of JSON-adjacent formats that have emerged over the years, each extending or modifying the base specification to solve problems the original format wasn't designed for.
    JSONL  - JSON Lines
    Açıklaması şöyle. Streaming ve memory problemini çözer
    JSONL is multiple independent JSON objects, one per line. Each line is a complete, valid JSON record. A thousand records means a thousand lines, each standing alone.
    Örnek
    Şöyle yaparız
    // Regular JSON - one structure
    {
      "records": [
        {"id": 1, "name": "Alice", "status": "active"},
        {"id": 2, "name": "Bob", "status": "inactive"},
        {"id": 3, "name": "Carol", "status": "active"}
      ]
    }
    // JSONL - one record per line
    {"id": 1, "name": "Alice", "status": "active"}
    {"id": 2, "name": "Bob", "status": "inactive"}
    {"id": 3, "name": "Carol", "status": "active"}

    JSON5 ve JSONC - JSON with Comments
    Açıklaması şöyle
    Allows comments and trailing commas for more forgiving configuration files. JSONC (JSON with comments, used by VSCode) does something similar.
    BISON - Binary JSON
    Açıklaması şöyle
    Powers MongoDB's internals.
    EJSON (Extended JSON)
    Açıklaması şöyle
    Adds additional type support. 
    GeoJSON
    Açıklaması şöyle
    Structures geographic data.



    28 Eylül 2026 Pazartesi

    Yazılım Mimarisi - Replication Consistency

    Giriş
    Açıklaması şöyle
    The primary replica set up will result in update delay in replicas and is a classic eventual consistency model. Essentially we trade strong consistency for read scalability. Eventual consistency is enough for most applications, except for ones requiring ‘read your write’ consistency.

    ‘Read your write’ consistency can be improved by forcing the read request to primary if it’s following a write. Or naively force the read to wait for several seconds so that all replicas have caught up. When there are replicas not in the same datacenter(DC), the read will also need to be restricted to the same DC.
    Read-your-own-writes consistency 
    Farklı çözümler var

    1. Route To Master
    Açıklaması şöyle
    ... 
    a user updates their profile and doesn't see the change.
    ...
    But there's a catch nobody warns you about: replication lag.

    Your replica is 200ms behind master. User changes their avatar, page reloads, reads from replica - old avatar. "Did my update even save?" They click save again. Now you have a duplicate write and a confused user.

    The fix is called read-your-own-writes consistency. After a write, route that specific user's reads to master for the next N seconds. Everyone else still reads from replicas. This solves 90% of "my changes disappeared" tickets.

    Implementation: set a short-lived cookie or Redis key after a write. Middleware checks it - if present, route to master. If expired, back to replica. Five lines of code that save you hundreds of bug reports.

    2. Short TTL Redis Kullanmak
    Örnek
    Şöyle yaparız
    // CORRECT — a user's own recent writes are read from the primary
    @Service
    @RequiredArgsConstructor
    public class ProfileService {
        private final RecentWriteTracker recentWrites; // Redis, short TTL
        @Transactional
        public void updateProfile(Long userId, ProfileRequest request) {
            User user = userRepository.findById(userId).orElseThrow();
            user.applyChanges(request);
            userRepository.save(user);
            recentWrites.mark(userId, Duration.ofSeconds(10)); // Longer than max lag
        }
        public UserProfile getProfile(Long userId) {
            return recentWrites.hasRecentWrite(userId)
                ? readFromPrimary(userId)   // This user just wrote - don't risk the replica
                : readFromReplica(userId);  // Everyone else reads the cheap path
        }
    }


    25 Eylül 2026 Cuma

    Redis - Bitset Veri Yapısı

    Giriş
    Komutlar şöyle
    SETBIT
    GETBIT
    BITCOUNT
    BITOP
    BITPOS

    SETBIT
    Bir kullanıcının yılın hangi gününde giriş yapıtğını atamak için şöyle yaparız
    SETBIT sign:123 10 1

    Burada sign:123 key yani kullanıcı adı, 10 ise bitoffset ve bit değeri 1

    GETBIT
    Okumak için şöyle yaparız
    GETBIT sign:123 10

    BITCOUNT
    Bu kullanıcı yılın kaç günü giriş yapmış görmek için şöyle yaparız
    Okumak için şöyle yaparız

    BITOP
    İki tane kullanıcının bitsetlerini karşılaştırmak için şöyle yaparız
    BITOP AND result sign:d123 sign:124

    sonra şöyle yaparız
    BITCOUNT result

    23 Eylül 2026 Çarşamba

    Cache Stratejileri - Cache Stampede

    Giriş
    Açıklamalar çoğunlukla buradan.

    1. No protection
    Every caller discovers the miss and independently loads the value.

    This is the classic cache stampede / thundering herd.

    The dangerous part is that the application may be completely correct. The database is simply receiving an unexpected burst.

    2. Local singleflight
    Here, each application instance says:

    "If another thread on this same machine is already loading this key, I'll wait for its result."

    Burada halen pod sayısı kadar hit gelebilir.

    3. Fleet refresh lease
    Only the pod that acquires the lease is allowed to refresh. Burada A uyandı ancak işi bitiremedi, sonra B uyandı işi bitirdi ve daha sonra A uyandı o da işi bitirdi ancak eski veriyi yazdı problemi var. Yani optimistic lock koymak lazım

    4. Stale-while-revalidate
    you distinguish:
    - fresh
    - stale-but-usable
    - too-old / unavailable

    Stale iken de veriyi sunar

    The TTL jitter
    Hepsi için kullanılabilir. Açıklaması şöyle
    Bad jitter
    If you do:
    TTL = maxTTL + random()

    then everything is already guaranteed to live at least maxTTL.

    You're spreading the expiration times, but you're also violating the intended freshness boundary.

    Subtractive jitter
    Instead:
    TTL = maxTTL - random()

    gives:
    maxTTL-0
    maxTTL-3
    maxTTL-17
    maxTTL-42
    ...

    So everything expires at or before the maximum freshness deadline.

    The important concept isn't really the exact formula.

    It's:

    Randomize expiration without extending the maximum allowed lifetime.







    18 Eylül 2026 Cuma

    Workflow vs Use case

    Workflow
    The workflow is the long-running process required to accomplish an operation
    Use case
    A use case represents a business action.
    Şöyle düşünebiliriz.
    Use case:
        create/update/delete business object
        apply business rule
        complete a business operation
        produce business events
    Book Keepin
    The retry count, lease, sent flag, processing flag, backoff timestamp, etc. exist solely so the workflow can safely coordinate work.

    Örnek
    Use case : Register User

    Implementation:

    - Validate email is unique
    - Create user
    - Assign default role
    - Store user
    - Publish UserRegistered event
    Workflow şöyle. The workflow spans time, retries, external systems, and multiple transactions.
    User Registration Workflow

      - Register User use case
      - Send verification email
      - Wait for user click
      - Timeout after 7 days
      -  Resend email
      -  Activate account
    Db Book Keeping Operations
    Hem workflow, hem de use case içinde book keeping transactions olabilir. Bunlar use case anlamına gelmezler.

    Örnek
    X Delivery Workflow
    │
    ├─ find pending delivery
    ├─ mark SENDING                 ← DB operation
    ├─ send UDP segment 1
    ├─ wait for ACK
    ├─ send UDP segment 2
    ├─ wait for ACK
    ├─ timeout?
    │    └─ mark BACKOFF            ← DB operation
    │
    ├─ retry
    │
    ├─ final ACK
    │    └─ CompleteDelivery    ← Use case
    │
    └─ publish resulting events


    9 Eylül 2026 Çarşamba

    Inventory Reservation Checkout

    Giriş
    Açıklaması şöyle
    Shopify replaced Redis with MySQL for one of their most critical checkout workloads. The trick was surprisingly simple.


    Every time a buyer clicks "Complete purchase," Shopify has milliseconds to answer one question: is that last unit still available?


    If Shopify says yes when the item is already gone, two people could buy the same item, leading to a cancelled order, an apology email, and a loss of trust.


    If they say no when the item is actually available, they lose a genuine sale.


    For years, Shopify used Redis to handle inventory reservations during checkout. When a customer started buying an item, Shopify would reserve that item in Redis so another customer couldn't buy the same unit at the same time.


    But the actual inventory lived in MySQL, so reservations and inventory updates happened in two different systems with no shared transaction. A payment could succeed while the inventory update failed, causing an oversell, or the inventory could be deducted while the Redis reservation remained, causing an undersell.


    The obvious fix was to move reservations into MySQL too, so everything could happen in one atomic transaction.


    But MySQL had already failed at this once. Their first attempt used a single row with a quantity column, and at checkout scale, every buyer fought over that one row. Locking it, waiting, retrying. It buckled.


    This is where the magic comes in.


    Instead of using one row per item with its available quantity, they used one row for each individual unit. So an item with 10 units gets 10 rows. To reserve three units, they simply grab any three available rows.

    And then the key: MySQL 8's 𝗦𝗞𝗜𝗣 𝗟𝗢𝗖𝗞𝗘𝗗.


    Normally, if a query wants rows another transaction has locked, it waits, everyone queues behind the same rows, and throughput collapses. SKIP LOCKED flips that: if some rows are locked, MySQL simply skips them and hands back other free ones. No waiting. No queue on a hot row.


    So when 500 buyers check out the same product at once, they're not fighting over one row, they each quietly grab a different free unit and move on. Contention, which killed the naive design, basically disappears.


    To keep it fast at huge scale, they cap the pool at ~1,000 rows per item and refill it from the ledger as it drains. Same idea, bounded.


    That's the whole trick: turn "everyone fights over one number" into "everyone grabs a different row." A single database feature made MySQL viable for a workload people assumed needed specialized infrastructure.


    The boring database you already run is often more capable than you think. MySQL didn’t just handle Shopify’s scale, it also made their system much simpler.

    Caddy Reverse Proxy

    Change host file
    C:\Windows\System32\drivers\etc\hosts
    Add

    #Caddy
    127.0.0.1 foo.com.local

    Start caddy
    caddy fmt --overwrite --config .\Caddyfile
    caddy run --config .\Caddyfile

    Import Root CA
    caddy trust

    To check Root CA go to
    C:\Users\acelya\AppData\Roaming\Caddy\pki\authorities\local
    You will see root.crt and root.key files

    My certificate is at
    C:\Users\acelya\AppData\Roaming\Caddy\certificates\local\foo.com.local


    Check Root CA
    Run
    certmgr.msc

    Go to "Trusted Root Certification Authorities -> Certificates"
    You should see Caddy Local Authority

    Visit
    https://foo.com.local

    Import Root CA To Remote Clients
    Copy root.crt file to other client computers and install it into the "Trusted Root Certification Authorities" store
    Command to import on Windows (run as Administrator)
    certutil -addstore -f "ROOT" root.crt

    Or via GUI
    - Double click root.crt -> Install certificate
    - Select Local Machine -> Place all certificates in the following store
    - Browse to Trusted Root Certification Authorities -> OK -> Finish

    Why root.crt and not intermediate.crt ?
    - root.crt - The root CA certificate. Clients trust this once, then autimatically trust every certificate Caddy issues
    - intermediate.crt - signed by root.crt, but clients need the root in their trust store to validate the chain. Distributing the intermediate alone doesn't help unless the root in already trusted.

    Örnek Caddyfile
    # Caddy auto_https normally binds to port 80 for HTTP -> HTTPS redirects
    # disable_redirects keeps TLS on 443 but prevents binding to port 80
    # Needed on Windows where port 80 required admin privileges
    {
      auto_https disable_redirects
    }

    # HTTPS-only listener on port 44
    foo.com.local:443 {
      tls internal

      # Swagger UI-served by the Spring Boot app
      handle /swagger-ui/* {
        reverse_proxy localhost:8080
      }

     # OpenAPI docs served by the Spring Boot app
      handle /v3/api-docs/* {
        reverse_proxy localhost:8080
      }
     # REST endpoints
      handle /api/* {
        reverse_proxy localhost:8080
      }
     # Everything else -> frontend
      handle {
        reverse_proxy localhost:3000
      }
    }



    13 Ağustos 2026 Perşembe

    Cuckoo Filter -

    Giriş
    Bloom Filtreden farklı olarak silmeyi destekler. Açıklaması şöyle
    A Cuckoo filter is a probabilistic data structure that supports approximate set membership with the ability to add, lookup, and delete items. It stores a small fingerprint of each item in a fixed-size bucket array. Lookups tell you:

    - Definitely not present — you can trust this and skip the expensive check.
    - Possibly present — you must verify against the source of truth.

    It’s called “cuckoo” because it uses cuckoo hashing: each item has two candidate buckets. If both are full during insertion, the filter evicts an existing fingerprint and moves it to its alternate bucket, potentially triggering a cascade of evictions — like a cuckoo bird pushing eggs out of a nest.


    10 Temmuz 2026 Cuma

    Positional Block Encoding - Hierarchical Block Allocation

    Giriş
    Verilen n kademe/seviye girdiyi tek bir sayıya çevirir

    1. İki Kademe
    Formül şöyle
    - areaNo
    - systemNo
    - SYTEMS_PER_AREA - Yani base
    - TERMINALS_PER_SYSTEM
    - BLOCK_SIZE

    Start : (areaNo * SYTEMS_PER_AREA + systemNo) * TERMINALS_PER_SYSTEM
    End : Start + BLOCK_SIZE
    Yeni bir sabit hesaplarız
    TERMINALS_PER_AREA = SYTEMS_PER_AREA * TERMINALS_PER_SYSTEM
    Sonra
    start = (areaNo * TERMINALS_PER_AREA) + (systemNo * TERMINALS_PER_SYSTEM)
    ve end
    start + BLOCK_SIZE


    1 Haziran 2026 Pazartesi

    DMR (Digital Mobile Radio) Notlarım

    Kişisel Notlar

    DMR standardı, ETSI, European Telecommunications Standards Institute tarafından yazılmış.

    İngilizce kullanımda portable radio el telsizi demek. Yani

    Portable Radio - El telsizi
    Mobile Radio - Araç Telsizi

    Tiers
    Açıklaması şöyle
    Understanding the DMR Tiers is not strictly necessary but knowing which Tier your radio is, is very important.

    TIER 1 - Radio to Radio
      Simplex only. No Time slots. This means it cannot be used on amateur repeaters as it would use up both time slots.
    The original Boefeng DM5R was Tier 1 only. DM5R+ had Tier 2.
    TIER 2 - Repeater-based
       Supports 2 Time Slots (TDMA). What us Amateurs Use
    TIER 3
    Advanced Trunked system. Complicated Commercial system allows for automatic repeater switching plus many other things.
    Similar to the Airwave system used by the emergency services.
    Tier 2 - Conventional DMR  - Single Site
    ETSI TS 102 361-2 dokümanında Tier II conventional air interface açıklanıyor. Aslında repeater centric olarak düşünülebilir.
    Site yoktur. Şeklen şöyle
    Talkgroup <-->  Repeater
    Tier 2 - Wide-Area DMR - Multi Site - Vendor Specific
    Site vardır. Siteler, bunların tanımları, nasıl roaming yapıldığı vs. hep üreticiye özel.
    Sitedeki repeaterlar IP ile (e.g. IP Site Connect) birbirlerine bağlanır.
    Şeklen şöyle. Burada telsizler sitelerle ilişkilenir. Sitelerin kimlik numarası vardır ve birbirlerine yönlendirmeyi ağ yönetim Ip uygulaması bilir ve yapar. Yani routing statiktir.
    Talkgroup <-->  Site <--> Repeaters
    Tier III - Trunk DMR
    ETSI TS 102 361-4 dokümanında  açıklanıyor. Site, Control channel, Traffic channels, Base stations (repeaters), Site identifiers, Registration, Roaming between sites,  Dynamic channel/timeslot assignment gibi şeyler açıklanıyor

    Channel
    Kanala bazı özellikler atanabilir. Bunlar üreticiye mahsus şeylerdir
    - Kanal seçilince otomatik olarak bir Talk Group dinlenmeye başlanır
    - Kanal seçilince otomatik olarak kriptolu/açık iletişim kullanılır

    Channel Plan
    Açıklaması şöyle
    A channel plan is the mapping between logical channel numbers (LCNs) and actual RF frequencies used by a DMR system.
    Açıklaması şöyle
    The DMR standard defines the concept of logical channels and how channel information can be communicated, but the actual channel plan (the specific frequencies and LCN assignments) is determined by the system operator or vendor deployment.
    Açıklaması şöyle
    A grant such as:

    > Talkgroup 1001 → LCN 2 → Slot 1

    means:

    > Tune to 451.0125 MHz and use Slot 1.
     OTAP — Over-The-Air Programming
    Açıklaması şöyle
    OTAP allows a radio's configuration (codeplug) to be updated remotely through the radio network instead of connecting a programming cable.
    OTAP protokolü üreticiye mahsustur ve muhtemelen all radios gönderim yeteneği vardır.

    OTAR — Over-The-Air Rekeying
    Açıklaması şöyle
    OTAR is completely different. OTAR updates cryptographic keys, not radio configuration.
    CSBK - Control Signalling Block
    CSBK yazısına taşıdım

    Simulcast Zone
    Açıklaması şöyle.
    Simulcast zone, birden fazla fiziksel siteyi tek bir RF hücre (logical site/cell) gibi çalıştıran senkronize yayın domain’idir.
    Şeklen şöyle. Bu yüzden siteler arasında roaming olmuyor.
    Site A ─|
    Site B ─|── same frequency, same slot, same content
    Site C ─|
    Açıklaması şöyle. Yani tekrarlayıcıların (repeater) senkronizasyonu çok önemli.
    The challenge with simulcast is that a radio may receive signals from A, B, and C simultaneously. Therefore the transmitters must be synchronized very precisely (typically GPS-disciplined timing and frequency references). Otherwise the overlapping signals create destructive interference.
    Talk Group
    Açıklaması şöyle
    A DMR GROUP  (Often called a “talkgroup” ) is a method of grouping or assembling multiple users (Radio ID’s) to a single contact. A Group or “talk group” is simply a group of users that need to talk to each other and hear all the communications in that group. 

    - An example would be all the maintenance personnel at a hospital would need to all share communications with each other. So, you would create the  “maintenance” group.
    Broadcast: Bazı gruplar abone üye olsun olmasın global kabul edilir ve tüm telsizlere yayın yapar
    Roaming : Telsiz site değiştirdikçe roaming bayrağına göre bu gurubu dinlemeye devam eder. 

    Tier 1 – RF Control & Channel Architecture (DMR Systems)


    1. Trunking Architecture Types

    1.1 Site-Controlled Channel Allocation

    • Each site manages its own channel allocation
    • Decisions are made locally at site level
    • Traffic channel assignment is handled by the site
    • No mandatory centralized routing entity

    1.2 Centralized Architecture (Star Topology)

    Central system is managed by ISS (Integrated Soft Switch) in a star topology.

    Topology
    • Star topology
    • All sites connect to central ISS
    • Routing decisions are centralized
    Call / Channel Allocation Flow
    1. Radio locks to site control channel
    2. Site forwards registration to ISS
    3. ISS performs authorization and routing decision
    4. ISS instructs site to assign traffic channel
    5. Site executes RF channel assignment

    Summary: Site executes, ISS decides.


    2. Channel Types

    2.1 RF carrier bandwidth

    Dijital kanal 12,5 kHz bant genişliğindedir. Analog kanal DMR standardı değildir ama kullanılır ve genellikle 25 kHz bant genişliğindedir

    2.2 Analog Channel

    • Not part of DMR traffic
    • Supported for legacy systems

    2.3 DMR Conventional Channel

    Simplex (P2P)

    • Radio-to-radio communication
    • No repeater
    • Direct communication model

    Repeater Mode

    • Uses repeater infrastructure
    • Extends coverage
    • Frequency pair operation

    2.4 DMR Trunked Channel (Tier III)

    • Dynamic channel allocation
    • Separation of control and traffic planes
    Channel Types:
    • Control Channel: signaling and system control
    • Traffic Channel: voice/data communication

    3. Squelch (Muting Mechanism)

    Squelch is a receiver function that mutes speaker output when no valid signal is present. Without it, constant background noise ("hiss") would be heard.


    4. Squelch Types

    4.1 Color Code (Digital Squelch)

    • Used in digital DMR channels
    • Equivalent to CTCSS/DCS in analog systems
    • Range: 1–15
    • Filters unrelated digital systems on same frequency

    4.2 Tone Squelch (CTCSS – Analog)

    • Uses sub-audible tones (e.g. 88.5 Hz)
    • Must match for audio to open
    • Allows frequency sharing without interference

    4.3 Digital Squelch (DCS – Analog)

    • Digital code-based squelch
    • Alternative to CTCSS
    • Uses digital patterns instead of tones

    5. ANI - Automatic Number Identification

    Sadece analog kanallarda olur. Analog tone ile arama yapan telsiz kimliği karşı tarafta gösterilir.

    5. SelectiveCall

    Sadece analog kanallarda olur. Analog tone ile aranan telsizin ses çıkarması sağlanır.

    6. Kripto

    Aslında DMR standardında kripto tanımlı değil. Çoğu üretici kanala bağlı bir kripto tanımlıyor. Telsiz kanal değiştirince, o kanal için tanımlı kripto algoritmasını kullanıyor

    7. Repeater

    Repeater'lar katmanlı çalışır ve birbirlerine trafik gönderebilirler

    8. System Mental Model

    More to come

    21 Nisan 2026 Salı

    Monitoring vs. Observability

    Giriş
    Açıklaması şöyle
    Monitoring answers: "Is something wrong?" and observability answers: "Why is it wrong?" You need both.
    Açıklaması şöyle
    In practice, you need three things. Metrics are used to detect problems, logs to explain errors, and traces to discover latency. If your metrics are wrong, you would never know that something is failing. And if you don't know something is failing, you never check logs and traces, which is why metrics are the entry point of any investigation.
    Monitoring Challenges
    Açıklaması şöyle
    Most of the time, teams don't have strategies for monitoring. It is the last backlog item to be picked up before the final production release. One service team adds a dashboard, another adds alerts, and a third team introduces a different naming convention.

    Six months down the line, you get duplicate metrics and inconsistent naming. There are no standard dashboards and alerts that nobody trusts. Eventually, teams ignore alerts, stop relying on monitoring, and fall back to guesswork. That is a dangerous place to be.

    One pattern I have seen repeatedly is metric explosion without clarity. A service exposes 400 metrics, and nobody knows which one matters.

    Good monitoring is not about collecting more metrics. It is about collecting the right metrics. A production-ready service rarely needs more than 10-20 core metrics and a small number of critical alerts. Everything else is an investigation detail. Not an operational signal.
    Yazar 4 tane metriğin takip edilmesi gerektiğini söylüyor
    1. Latency: Earliest Signal
    Burada ortalamaları (average) gösteren metriklerin işe yaramadığını söylüyor. Percentile p50, p90 gibi bakmak daha iyi. Eğer p99 hareket etmeye başlarsa bir problem var anlamına gelir.
    Örnek
    Şöyle yaparız. order-service içindeki end pointleri gösterir.
    uri : groups metrics per endpoint, 
    le : “less than or equal”
    anlamına gelir.
    # Latency (p50, p95, p99)
    histogram_quantile(0.50, 
      sum(rate(http_server_requests_seconds_bucket{application="order-service"}[5m])) by (uri, le)
    )
    histogram_quantile(0.95, 
      sum(rate(http_server_requests_seconds_bucket{application="order-service"}[5m])) by (uri, le)
    )
    histogram_quantile(0.99, 
      sum(rate(http_server_requests_seconds_bucket{application="order-service"}[5m])) by (uri, le)
    )
    2. Traffic: System Load
    Açıklaması şöyle
    Traffic metrics include requests per second, events per second, messages per second, and batch rates. Most incidents begin with a traffic change. Sometimes expected and sometimes not.

    A common pattern that I have always observed: Traffic increases, and that increases latency. Integrations slow down, and errors appear. Without traffic metrics, the root cause looks mysterious. With traffic metrics, it becomes obvious.

    Prometheus query example:

    Requests per second:

    rate(http_server_requests_seconds_count[1m])

    This metric alone explains a surprising number of incidents.
    3. Errors - The most misunderstood signal
    Burada şunlar önemli. 
    - Error rate is more important than error count
    - 4xx vs 5xx - Critical distinction

    4. Saturation — Where failures actually begin
    - CPU and Memory - Necessary but not enough
    - Connection pool usage.
    - Kubernetes saturation signals