<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ÖMER FARUK İÇEN on Medium]]></title>
        <description><![CDATA[Stories by ÖMER FARUK İÇEN on Medium]]></description>
        <link>https://medium.com/@omerfarukicen?source=rss-904821088192------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qKTWf3ZZD3xpPphMYqn6Eg.jpeg</url>
            <title>Stories by ÖMER FARUK İÇEN on Medium</title>
            <link>https://medium.com/@omerfarukicen?source=rss-904821088192------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 08:19:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omerfarukicen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Chaos Mesh]]></title>
            <link>https://medium.com/@omerfarukicen/chaos-mesh-8e284dc186be?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e284dc186be</guid>
            <category><![CDATA[chaos-mesh]]></category>
            <category><![CDATA[chaos-engineering]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Wed, 22 Oct 2025 06:38:51 GMT</pubDate>
            <atom:updated>2025-10-22T06:47:51.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xWCKHicCIhFj_GbD" /></figure><p>Chaos Mesh is an open-source <strong>chaos engineering platform</strong> for Kubernetes.. It offers various types of fault simulation and has an enormous capability to orchestrate fault scenarios.</p><p>With Chaos Mesh, you can:</p><ul><li>Simulate failures in Pods (kill pods , JVM Fault)</li><li>NetworkChaos -&gt; Latency, packet loss, network partition, attact</li><li>IOChaos -&gt; Disk read/write errors</li><li>StressChaos -&gt; CPU or memory pressure</li><li>DNSChaos -&gt; DNS resolution failures</li><li>Measure how your system responds</li><li>Schedule and visualize experiments through a user-friendly dashboard</li></ul><h3><strong>Arhitecture</strong></h3><p><strong>Chaos Dashboard</strong>: The visualization component of Chaos Mesh.</p><p><strong>Chaos Controller Manager</strong>: The core logical component of Chaos Mesh. management of Chaos experiments. This component contains several CRD Controllers, such as Workflow Controller, Scheduler Controller, and Controllers of various fault types.</p><p><strong>Chaos Daemon</strong>: The main executive component. Chaos Daemon runs in the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/">DaemonSet</a> mode</p><h3>Quick Start</h3><pre>helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-mesh --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock --version 2.8.0</pre><pre>kubectl apply -f - &lt;&lt;EOF<br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: ClusterRole<br>metadata:<br>  name: clusterrole-chaos-mesh-manager-nugyl<br>rules:<br>- apiGroups: [&quot;&quot;]<br>  resources: [&quot;pods&quot;, &quot;namespaces&quot;, &quot;nodes&quot;]<br>  verbs: [&quot;get&quot;, &quot;watch&quot;, &quot;list&quot;]<br>- apiGroups: [&quot;chaos-mesh.org&quot;]<br>  resources: [&quot;*&quot;]<br>  verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;, &quot;create&quot;, &quot;delete&quot;, &quot;patch&quot;, &quot;update&quot;]<br>EOF</pre><pre>kubectl apply -f - &lt;&lt;EOF<br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: ClusterRoleBinding<br>metadata:<br>  name: clusterrolebinding-chaos-mesh-manager-nugyl<br>subjects:<br>- kind: ServiceAccount<br>  name: account-chaos-mesh-manager-nugyl<br>  namespace: chaos-mesh<br>roleRef:<br>  kind: ClusterRole<br>  name: clusterrole-chaos-mesh-manager-nugyl<br>  apiGroup: rbac.authorization.k8s.io<br>EOF</pre><pre>kubectl get pods -n chaos-mesh -l app.kubernetes.io/instance=chaos-mesh<br><br>kubectl port-forward -n chaos-mesh chaos-dashboard-pod 2333:2333</pre><p><strong>DASHBOARD</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yKgrQPBJQp9oSElziW7oWA.png" /></figure><pre>kubectl get serviceaccount --all-namespaces | grep chaos-mesh<br>kubectl create token account-chaos-mesh-manager-ebrbc -n chaos-mesh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bFBAiJQJxDDjCJjCSB5R5Q.png" /></figure><pre>kind: HTTPChaos<br>apiVersion: chaos-mesh.org/v1alpha1<br>metadata:<br>  namespace: chaos-mesh<br>  name: api-gateway-slow-response<br>spec:<br>  selector:<br>    namespaces:<br>      - development<br>    labelSelectors:<br>      app: api-gateway<br>  mode: all<br>  target: Request       # The target of the experiment: modify HTTP requests.<br>  delay: 10s            # Inject a synthetic delay of 10 seconds into each HTTP request.<br>  port: 8080            # The port the target application is listening on.<br>  path: &#39;*&#39;             # Apply to all paths (e.g. /login, /api/v1/user, etc.).<br>  method: POST          # Apply only to POST requests.<br>  duration: 10m         # Total duration of the experiment: 10 minutes (delay active for 10 minutes).</pre><h3><strong>Conclusion</strong></h3><p>The goal isn’t to break your system — it’s to learn how it behaves when it <em>does</em> break.</p><blockquote><em>“Resilience isn’t about avoiding failure — it’s about surviving it.”</em></blockquote><h3>Further Reading</h3><ul><li><a href="https://chaos-mesh.org/docs/">Chaos Mesh Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e284dc186be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PgCat: The Modern Proxy Solution for PostgreSQL]]></title>
            <link>https://medium.com/codable/pgcat-the-modern-proxy-solution-for-postgresql-938a41755f91?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/938a41755f91</guid>
            <category><![CDATA[pgcat]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Sat, 24 May 2025 07:20:46 GMT</pubDate>
            <atom:updated>2025-06-27T06:05:46.675Z</atom:updated>
            <content:encoded><![CDATA[<p>PostgreSQL is a powerful open-source relational database, but as workloads grow, managing connections and scaling reads/writes becomes challenging. Traditional solutions like PgBouncer and PgPool-II have served well but come with limitations in modern cloud-native environments.Unlike traditional solutions, PgCat supports multi-tenant architectures and is optimized for high concurrency.</p><h3>Key Features and Comparative Advantages</h3><h4><strong>1. Read/Write Splitting</strong></h4><ul><li>Automatically routes SELECT queries to read replicas and INSERT, UPDATE, DELETE, and other write queries to the primary node.</li><li>Uses SQL parsing to determine the type of query.</li><li>Helps in scaling read-heavy workloads by offloading read operations to replicas.</li></ul><p><strong>Advantage over PgPool-II:</strong></p><ul><li>More accurate query classification</li><li>Lower latency routing decisions</li><li>Simpler configuration</li></ul><h4><strong>2. Connection Pooling</strong></h4><ul><li>Reduces the overhead of establishing new connections by pooling and reusing existing ones.</li><li>Supports per-user and per-database connection pools.</li><li>Configurable pool sizes and timeouts.</li></ul><p><strong>Alternative : Pgbouncer</strong></p><ul><li><strong>PgCat </strong>is a multi-threaded proxy written in Rust using the Tokio asynchronous runtime.<strong> Pgbouncer</strong> is a single-threaded proxy written in C based on libevent. <strong>PgCat </strong>is multi-threaded so it can benefit from more CPU cores on the machine it runs on.</li><li><strong>PgBouncer:</strong> Requires a restart or admin commands to reload configuration, which can disrupt active connections. <strong>PgCat:</strong> Supports <strong>hot reloads with zero downtime</strong> — config changes (like adding pools or nodes) apply live.</li></ul><p><a href="https://www.tembo.io/blog/postgres-connection-poolers">https://www.tembo.io/blog/postgres-connection-poolers</a></p><h4><strong>3. Replica Lag Awareness</strong></h4><ul><li>PgCat can track replication lag of read replicas and avoid sending queries to lagging replicas.</li><li>Helps ensure data freshness for read queries when consistency is important.</li></ul><p><strong>Alternative : PgPool|| and Patroni HA proxy</strong></p><ul><li>Pgpool-II supports replica lag monitoring, but it is not as advanced or as easily configurable as PgCat in this regard. It is a more traditional solution with broader features, but it is more limited and complex when it comes to lag awareness.</li><li>Patroni is a high-availability solution for PostgreSQL. When used together with HAProxy, HAProxy can route queries based on lag status or health check results. However, lag awareness in this setup may still require custom configuration and scripting.</li></ul><h4><strong>4. Automatic Failover Handling</strong></h4><p>Supports automatic failover to a new primary if the existing primary becomes unavailable. (Alternative: Patroni &amp; PgPool||)</p><h4><strong>5. Multi-Tenant and Multi-Database Support</strong></h4><ul><li>Can serve multiple databases and tenants from a single PgCat instance.</li><li>Each pool configuration can have its own primary and replicas.</li></ul><h4><strong>6. Config Reloading Without Restart</strong></h4><ul><li>Configuration can be reloaded on the fly (e.g., adding/removing replicas or changing settings) without restarting PgCat.</li></ul><h4><strong>7. Lightweight and Fast</strong></h4><ul><li>Written in Rust for performance and safety.</li><li>Designed to handle thousands of concurrent connections efficiently.</li></ul><h4><strong>8. Observability</strong></h4><ul><li>Exposes Prometheus-compatible metrics.</li><li>Logging and monitoring features help track query distribution, pool usage, and replica health.</li><li>Sample metrics endpoint settings:</li></ul><pre>curl http://localhost:9930/metrics</pre><h3>Hands-On Demonstration</h3><p>Let’s set up the application and create an example using Docker Compose</p><pre>version: &#39;3.8&#39;<br>x-postgres-common:<br>  &amp;postgres-common<br>  image: postgres:14-alpine<br>  user: postgres<br>  restart: always<br>  healthcheck:<br>    test: &#39;pg_isready -U postgres --dbname=postgres&#39;<br>    interval: 10s<br>    timeout: 5s<br>    retries: 5<br><br>services:<br>  postgres_primary:<br>    &lt;&lt;: *postgres-common<br>    ports:<br>      - 5434:5432<br>    environment:<br>      POSTGRES_USER: postgres<br>      POSTGRES_DB: postgres<br>      POSTGRES_PASSWORD: postgres<br>    command: |<br>      postgres <br>      -c wal_level=replica <br>      -c hot_standby=on <br>      -c max_wal_senders=10 <br>      -c max_replication_slots=10 <br>      -c hot_standby_feedback=on<br>      -c hba_file=/etc/postgresql/pg_hba.conf<br>      -c logging_collector=on<br>      -c log_directory=/var/lib/postgresql/data/logs<br>      -c log_filename=postgresql.log<br>      -c log_statement=all<br>      -c log_connections=on<br>      -c log_disconnections=on      <br>    volumes:<br>      - ./pg_hba.conf:/etc/postgresql/pg_hba.conf<br>      - ./00_init.sql:/docker-entrypoint-initdb.d/00_init.sql<br><br>  postgres_replica:<br>    &lt;&lt;: *postgres-common<br>    ports:<br>      - 5433:5432<br>    environment:<br>      PGUSER: replicator<br>      PGPASSWORD: replicator_password<br>    command: |<br>    <br>      bash -c &quot;<br>      until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=replication_slot --host=postgres_primary --port=5432<br>      do<br>      echo &#39;Waiting for primary to connect...&#39;<br>      sleep 1s<br>      done<br>      echo &#39;Backup done, starting replica...&#39;<br>      chmod 0700 /var/lib/postgresql/data<br><br>      exec postgres \<br>      -c logging_collector=on \<br>      -c log_directory=/var/lib/postgresql/data/logs \<br>      -c log_filename=postgresql.log \<br>      -c log_statement=all \<br>      -c log_connections=on \<br>      -c log_disconnections=on \<br>      -c log_destination=stderr<br>      &quot;<br>    depends_on:<br>      - postgres_primary<br>  pgcat:<br>    build: .<br>    command:<br>      - &quot;pgcat&quot;<br>      - &quot;/etc/pgcat/pgcat.toml&quot;<br>    volumes:<br>      - &quot;${PWD}/examples/docker/pgcat.toml:/etc/pgcat/pgcat.toml&quot;<br>    ports:<br>      - &quot;6432:6432&quot;<br>      - &quot;9930:9930&quot;<br>    depends_on:<br>      - postgres_replica</pre><p>init.sql</p><pre>create user replicator with replication encrypted password &#39;replicator_password&#39;;<br>select pg_create_physical_replication_slot(&#39;replication_slot&#39;);<br><br><br>GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO replicator;<br>ALTER DEFAULT PRIVILEGES IN SCHEMA public<br>GRANT ALL ON TABLES TO replicator;</pre><p>pgcat.toml.yml is the configuration file used to define PGCat settings<br>Configurations for Read-Write Splitting:</p><pre>[general]<br>host = &quot;0.0.0.0&quot;<br>port = 6432<br><br># Whether to enable prometheus exporter or not.<br>enable_prometheus_exporter = false<br><br># Port at which prometheus exporter listens on.<br>prometheus_exporter_port = 9930<br><br># How long to wait before aborting a server connection (ms).<br>connect_timeout = 5000<br><br># How much time to give `SELECT 1` health check query to return with a result (ms).<br>healthcheck_timeout = 1000<br><br># How long to keep connection available for immediate re-use, without running a healthcheck query on it<br>healthcheck_delay = 30000<br><br># How much time to give clients during shutdown before forcibly killing client connections (ms).<br>shutdown_timeout = 60000<br><br># For how long to ban a server if it fails a health check (seconds).<br>ban_time = 60 # seconds<br><br># If we should log client connections<br>log_client_connections = false<br><br># If we should log client disconnections<br>log_client_disconnections = false<br><br>admin_username = &quot;postgres&quot;<br>admin_password = &quot;postgres&quot;<br>[pools.postgres]<br>pool_mode = &quot;transaction&quot;<br>default_role = &quot;any&quot;<br><br><br>query_parser_enabled = true<br>query_parser_read_write_splitting = true<br><br>primary_reads_enabled = true<br>sharding_function = &quot;pg_bigint_hash&quot;<br>[pools.postgres.users.0]<br>username = &quot;postgres&quot;<br>password = &quot;postgres&quot;<br>pool_size = 50<br>statement_timeout = 0<br>[pools.postgres.shards.0]<br>servers = [<br>    [ &quot;postgres_primary&quot;, 5432, &quot;primary&quot; ],<br>    [ &quot;postgres_replica&quot;, 5432, &quot;replica&quot; ]<br>]<br>database = &quot;postgres&quot;</pre><p>First, access the primary PostgreSQL container:</p><pre>docker exec -it pgcat-main-postgres_primary-1 sh<br>psql -U postgres<br>CREATE TABLE product (<br>    id SERIAL PRIMARY KEY,<br>    product VARCHAR(255)<br>);<br>INSERT INTO product (product) VALUES (&#39;Laptop&#39;);<br>INSERT INTO product (product) VALUES (&#39;Smartphone&#39;);</pre><p>Let’s run the container and connect to the PgCat using psql:</p><pre>docker exec -it pgcat-main-postgres_replica-1 sh<br>psql -h 127.0.0.1 -p 6432 -U postgres <br><br>Select * from product;<br></pre><p><strong>You can easily observe this in the secondary logs.</strong></p><pre>tail -f /var/lib/postgresql/data/logs/postgresql.log</pre><p>Now, let’s continue exploring the configuration file in more detail.</p><p><strong>Thread Settings</strong></p><pre>path: general.worker_threads<br>default: 5</pre><p>Number of worker threads the Runtime will use (4 by default).</p><h4>Pooling Settings</h4><p>Furthermore, you can configure connection pooling on a per-user basis under the pools.&lt;pool_name&gt;.users.&lt;user_index&gt; section.</p><pre>pools:<br>  my_pool:<br>    pool_mode: &quot;transaction&quot;  # Connection mode: &quot;session&quot; or &quot;transaction&quot;<br>    load_balancing_mode: &quot;random&quot;  # Load balancing algorithm: &quot;random&quot;, &quot;loc&quot; (least connections)<br>    default_role: &quot;any&quot;  # Default routing: &quot;any&quot;, &quot;replica&quot;, &quot;primary&quot;<br>    query_parser_enabled: true  # Whether SQL query parsing is enabled<br>    primary_reads_enabled: true  # Whether primary can be used for read queries<br>    idle_timeout: 40000  # Connection idle timeout (milliseconds)<br>    connect_timeout: 3000  # Connection establishment timeout (milliseconds)</pre><h4>Multi Database Connection Settings</h4><pre>path: pools.database<br>default: &quot;shard0&quot;<br>path: pools.database2<br>default: &quot;shard1&quot;</pre><h4>primary_reads_enabled</h4><p>If the query parser is enabled and this setting is enabled, the primary will be part of the pool of databases used for load balancing of read queries. Otherwise, the primary will only be used for write queries. The primary can always be explicitly selected with our custom protocol.</p><pre>path: pools.&lt;pool_name&gt;.primary_reads_enabled<br>default: true</pre><h4><strong>Conclusion</strong></h4><p>PGCat helps you scale your PostgreSQL infrastructure efficiently — with minimal configuration and maximum flexibility.If you’re looking for a transparent, performant way to enhance your database connectivity layer without rewriting your application logic, <strong>PGCat is definitely worth trying</strong>.</p><p><strong>References<br></strong><a href="https://github.com/postgresml/pgcat">https://github.com/postgresml/pgcat</a></p><p><strong>Example:</strong><br><a href="https://github.com/postgresml/pgcat">https://github.com/omerfarukicen/pgcat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=938a41755f91" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codable/pgcat-the-modern-proxy-solution-for-postgresql-938a41755f91">PgCat: The Modern Proxy Solution for PostgreSQL</a> was originally published in <a href="https://medium.com/codable">Codable</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling PostgreSQL]]></title>
            <link>https://medium.com/@omerfarukicen/scaling-postgresql-911e876f0042?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/911e876f0042</guid>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Sun, 18 May 2025 18:42:09 GMT</pubDate>
            <atom:updated>2025-05-18T18:42:09.421Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGh7XFz41iLY7i1xE01e8Q.png" /></figure><p><strong>Scaling</strong> is the process of increasing system performance and capacity to handle more load. There are two types:</p><ul><li><strong>Vertical Scaling:</strong> Increasing the hardware resources (CPU, RAM, etc.) of a single server. Simple to implement but has physical limits.</li><li><strong>Horizontal Scaling:</strong> Distributing the load across multiple servers. More complex, but provides much better scalability.</li></ul><h3>1. Read-Bound Workload</h3><p>These systems mostly handle <strong>read operations</strong> (e.g., analytics, reporting).</p><ul><li><strong>Replication:</strong> One primary server and multiple replicas. Read traffic is directed to replicas to reduce load on the primary.</li><li><strong>Load Balancing:</strong> Distributes incoming traffic among multiple servers (e.g., HAProxy ,pgpool-II, PGCat).</li><li><strong>Connection Pools:</strong> Manages and reduces the number of active client connections (e.g., PgBouncer, pgpool-II).</li></ul><h3>2. ️ Write-Bound Workload</h3><ul><li><strong>Queuing:</strong> Write operations are pushed to a queue and processed asynchronously (e.g., with Kafka).</li><li><strong>Partitioning:</strong> Tables are split based on a key (e.g., by time) to reduce contention.</li><li><strong>Sharding:</strong> The database is split into smaller subsets (shards), each on a different server. (Partitioning Sharding , Querying Accross Sharding)</li><li><strong>Multi-Master:</strong> Multiple nodes can accept writes and synchronize between them. It’s complex but increases write throughput.</li></ul><h3>3. ️ High Availability</h3><p>The goal here is <strong>continuous uptime</strong> and system reliability.</p><ul><li><strong>Replication:</strong> Ensures data is mirrored to standby nodes. (e.g.,Streaming Replication, Logical Replication)</li><li><strong>Fail-over:</strong> If the primary fails, a replica is promoted to primary automatically. (e.g.,Repmgr, Patroni ,PgPool ||)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=911e876f0042" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Migration with OpenRewrite]]></title>
            <link>https://medium.com/@omerfarukicen/spring-boot-migration-with-openrewrite-df2adde58d9a?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/df2adde58d9a</guid>
            <category><![CDATA[spring-boot-3-upgrade]]></category>
            <category><![CDATA[openrewrite]]></category>
            <category><![CDATA[spring-boot-migration]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 17:20:29 GMT</pubDate>
            <atom:updated>2024-04-26T17:20:29.299Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s rapidly evolving tech landscape, keeping your Spring Boot applications up-to-date is essential to ensure security, performance, and maintainability. However, upgrading these applications can be a daunting task, especially for large codebases. In this article, we’ll explore how OpenRewrite can simplify the process of migrating Spring Boot applications to newer versions.</p><p><strong>Spring Boot Upgrades:</strong><br>Highlight the benefits such as security patches, performance improvements, and access to new features.</p><p><strong>OpenRewrite </strong>is a framework used for restructuring large-scale codebases. It provides a set of tools and utilities that allow developers to make extensive changes to their codebase efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kMNPXtEk4reZna8PWtPixQ.png" /></figure><pre>&lt;plugin&gt;<br>    &lt;groupId&gt;org.openrewrite.maven&lt;/groupId&gt;<br>    &lt;artifactId&gt;rewrite-maven-plugin&lt;/artifactId&gt;<br>    &lt;version&gt;5.29.0&lt;/version&gt;<br>    &lt;configuration&gt;<br>        &lt;activeRecipes&gt;<br>            &lt;recipe&gt;org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2&lt;/recipe&gt;<br>        &lt;/activeRecipes&gt;<br>    &lt;/configuration&gt;<br>    &lt;dependencies&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.openrewrite.recipe&lt;/groupId&gt;<br>            &lt;artifactId&gt;rewrite-spring&lt;/artifactId&gt;<br>            &lt;version&gt;5.8.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br>&lt;/plugin&gt;</pre><pre>mvn clean rewrite:discover<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*rEctapYmQaUXEro9.png" /></figure><pre>mvn clean rewrite:run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUbyKySDyE7rAWJeYBUkgQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df2adde58d9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring AI]]></title>
            <link>https://medium.com/@omerfarukicen/spring-ai-af5ac9e7ab43?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/af5ac9e7ab43</guid>
            <category><![CDATA[chatgptspring]]></category>
            <category><![CDATA[spring-openai]]></category>
            <category><![CDATA[spring-ai]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Sat, 02 Mar 2024 21:47:21 GMT</pubDate>
            <atom:updated>2024-03-02T21:47:21.125Z</atom:updated>
            <content:encoded><![CDATA[<p>The Spring AI API provides a comprehensive suite of functionalities designed to integrate artificial intelligence capabilities seamlessly within Spring applications. Here’s a summary of its key features:</p><ol><li>Portable API for AI Providers: Offers a unified API that works across various AI providers, covering services for Chat, Text to Image, and Embedding models. It supports both synchronous and stream API options, with the flexibility to access model-specific features. Major AI model providers like OpenAI, Microsoft, Amazon, Google, and Huggingface are supported.</li><li>Function Calling with AI Models: Simplifies the process of having an AI model invoke Java’s java.util.Function objects, allowing for direct interaction between AI models and your Plain Old Java Objects (POJOs).</li><li>Vector Store Integration: Features a portable API for Vector Store providers, including a novel SQL-like metadata filter API that is also portable. It supports 8 vector databases, facilitating easy integration and manipulation of vector data.</li><li>ETL Framework for Data Engineering: Includes an ETL (Extract, Transform, Load) framework designed for data engineering tasks. This framework supports the loading of data into vector databases and implements the Retrieval Augmented Generation pattern, enabling the enhancement of AI model responses with your own data.</li></ol><p><a href="https://github.com/omerfarukicen/spring-ai/tree/master">GitHub - omerfarukicen/spring-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af5ac9e7ab43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distributed vs Replicated Cache]]></title>
            <link>https://medium.com/@omerfarukicen/distributed-vs-replicated-cache-91c35be3f01d?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/91c35be3f01d</guid>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[replicated-cache]]></category>
            <category><![CDATA[replicated-caching]]></category>
            <category><![CDATA[distributed-caching]]></category>
            <category><![CDATA[distributed-cache]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 08:56:30 GMT</pubDate>
            <atom:updated>2024-01-16T08:59:32.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2dnabH75dTaeq5K5" /></figure><h3>Distributed Cache</h3><p>In a distributed cache, data is spread across multiple servers or nodes. Each piece of data is stored only on one node (or a few nodes for redundancy), but not on every node in the network.</p><ul><li>Scalability: It can easily scale out by adding more nodes.</li><li>Efficiency: Reduces load on the primary data source.</li><li>Performance: Faster access for geographically distributed systems, as data is closer to where it’s needed.</li></ul><p><strong>Use Cases:</strong></p><ul><li>Large-scale web applications.</li><li>Systems requiring high availability and quick data access.</li><li>Environments where data does not need to be identical across all nodes at all times.</li></ul><h3>Replicated Cache</h3><p>In a replicated cache, the same data is stored on all nodes in the cache. Whenever a piece of data is changed, the change is replicated across all nodes.</p><ul><li>Data Consistency: Ensures all nodes have the same data, providing strong consistency.</li><li>Reliability: Even if one node fails, the data is still available on other nodes.</li><li>Simplicity: Easier to manage since all nodes contain the same data.</li></ul><p><strong>Use Cases:</strong></p><ul><li>Systems where data consistency is critical.</li><li>Smaller-scale applications where the overhead of data replication is manageable.</li><li>Scenarios where read speed is more critical than write speed.</li></ul><h3>Summary</h3><ul><li><strong>Data Storage: </strong>Distributed caches store unique data across nodes, whereas replicated caches store identical data on all nodes.</li><li><strong>Scalability: </strong>Distributed caches are generally more scalable than replicated caches.</li><li><strong>Consistency vs. Availability:</strong> Distributed caches often prioritize availability and partition tolerance, while replicated caches prioritize consistency. On a cluster of three nodes, two nodes can crash and you do not lose data from a replicated cache.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91c35be3f01d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[17 Metrics to Help Build Better Software]]></title>
            <link>https://medium.com/@omerfarukicen/17-metrics-to-help-build-better-software-81dbaecceaf9?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/81dbaecceaf9</guid>
            <category><![CDATA[software-principles]]></category>
            <category><![CDATA[17-metrics]]></category>
            <category><![CDATA[better-software]]></category>
            <category><![CDATA[better-software-engineer]]></category>
            <category><![CDATA[build-better-software]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Thu, 11 Jan 2024 20:32:48 GMT</pubDate>
            <atom:updated>2024-01-11T20:32:48.138Z</atom:updated>
            <content:encoded><![CDATA[<p>Three categories: “CRAWL,” “RUN,” and “WALK” metrics, each focusing on different aspects of software development and delivery. The metrics range from deployment frequency and lead time for changes to team health and customer satisfaction. These metrics are essential for assessing and enhancing various dimensions of software development, such as efficiency, process bottlenecks, team workload distribution, and the alignment of product features with user needs.<br><strong>As the same point usefull table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6R92Us5o2YwUtrBmTHrytA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81dbaecceaf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Bench]]></title>
            <link>https://medium.com/@omerfarukicen/apache-bench-ce6ae3509ec4?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce6ae3509ec4</guid>
            <category><![CDATA[apache-benchmark]]></category>
            <category><![CDATA[apache-bench]]></category>
            <category><![CDATA[easy-stress-test]]></category>
            <category><![CDATA[stress-testing]]></category>
            <category><![CDATA[stress-test]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Sun, 07 Jan 2024 19:07:51 GMT</pubDate>
            <atom:updated>2024-01-07T19:07:51.517Z</atom:updated>
            <content:encoded><![CDATA[<p>Apache Bench, commonly known as ab, is a command-line tool that comes bundled with the Apache HTTP Server. It is designed for performing benchmarking or load testing on web servers by generating a significant number of requests to measure how well a web server responds under a specified load.</p><p>The basic usage of Apache Bench is as follows:</p><pre>ab -n 100 -c 10 http://example.com/</pre><p>Parameters:</p><ul><li>-n requests: Specifies the total number of requests to perform during the test.</li><li>-c concurrency: Sets the number of multiple requests to perform at a time.</li><li>-t timelimit: Sets a time limit for the test, terminating it after the specified number of seconds.</li><li>-k: Enables HTTP KeepAlive, allowing multiple requests to be sent over a single persistent connection.</li><li>-p POST-file: Allows sending POST data from a file.</li><li>-H headerline: Adds a header to the HTTP request.</li></ul><p>HttpMethods Examples:</p><ol><li><strong>GET</strong></li></ol><pre>ab -n 100 -c 10 http://example.com/</pre><p><strong>2. POST</strong></p><pre>ab -n 100 -c 10 -p post_data.txt -T application/json http://example.com/</pre><p><strong>3.DELETE</strong></p><pre>ab -n 100 -c 10 -X DELETE http://example.com/</pre><p>4.PUT</p><pre>ab -n 100 -c 10 -p put_data.txt -T application/json -X PUT http://example.com/resource</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce6ae3509ec4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distrubuted Lock Redis]]></title>
            <link>https://medium.com/@omerfarukicen/distrubuted-lock-redis-797f4c8b32a0?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/797f4c8b32a0</guid>
            <category><![CDATA[rlock]]></category>
            <category><![CDATA[redisson-lock]]></category>
            <category><![CDATA[distributed-locks]]></category>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 13:35:22 GMT</pubDate>
            <atom:updated>2024-01-02T13:35:22.039Z</atom:updated>
            <content:encoded><![CDATA[<p>Distributed locks are a mechanism used in distributed systems to coordinate access to shared resources. The goal is to ensure that only one process or node can access a particular resource at any given time, preventing conflicts and maintaining data consistency. Distributed locks become essential in scenarios where multiple processes or nodes need to coordinate their actions without interfering with each other.</p><p>Here are some key concepts and approaches related to distributed locks:</p><ol><li><strong>Centralized Locking Service:</strong> A simple approach is to use a centralized locking service, where a dedicated server manages the locks. Processes request a lock from the central server, and the server grants it to only one process at a time.</li><li><strong>Distributed Locking Algorithms:</strong> Various distributed locking algorithms have been developed to manage locks across multiple nodes in a distributed system. Examples include the Chubby lock service by Google, Apache ZooKeeper, and etcd. These systems provide distributed coordination and can be used for implementing distributed locks.</li></ol><h3><strong>RLock</strong></h3><p>https://redis.io/docs/manual/patterns/distributed-locks/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w12xGm8-vExmK3NIJLvLJA.png" /></figure><ul><li><a href="https://github.com/mrniko/redisson">Redisson</a> (Java implementation).</li></ul><p><strong>Redis Config</strong></p><pre>import org.redisson.Redisson;<br>import org.redisson.api.RedissonClient;<br>import org.redisson.config.Config;<br>import org.springframework.beans.factory.annotation.Value;<br>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br><br>@Configuration<br>public class RedisConfig {<br><br>    @Value(&quot;${spring.redis.host}&quot;)<br>    private String redisHost;<br><br>    @Value(&quot;${spring.redis.port}&quot;)<br>    private int redisPort;<br><br>    @Value(&quot;${spring.redis.password}&quot;)<br>    private String redisPassword;<br><br>    @Bean<br>    public RedissonClient redissonClient() {<br>        Config config = new Config();<br>        config.useSingleServer()<br>                .setAddress(&quot;redis://&quot; + redisHost + &quot;:&quot; + redisPort)<br>                //    .setPassword(redisPassword)<br>                .setConnectTimeout(5000)<br>                .setConnectionMinimumIdleSize(5)<br>                .setConnectionPoolSize(10);<br><br>        return Redisson.create(config);<br>    }</pre><p><strong>RedisLock Config</strong></p><pre>import lombok.RequiredArgsConstructor;<br>import org.redisson.Redisson;<br>import org.redisson.api.RLock;<br>import org.redisson.api.RedissonClient;<br>import org.springframework.stereotype.Component;<br><br>import javax.annotation.PostConstruct;<br><br>@Component<br>@RequiredArgsConstructor<br>public class RedisLock {<br><br>    private static final String LOCK_KEY = &quot;app-lock&quot;;<br>    private RLock lock;<br>    private final RedissonClient redisson;<br><br>    @PostConstruct<br>    public void init() {<br>        lock = redisson.getLock(LOCK_KEY);<br>    }<br><br>    public boolean tryLock() {<br>        //tryLock(long time, TimeUnit unit)<br>        return lock.tryLock();<br>    }<br><br>    public void unlock() {<br>        lock.unlock();<br>    }</pre><p><strong>Service:</strong></p><pre><br><br>import lombok.RequiredArgsConstructor;<br>import lombok.extern.slf4j.Slf4j;<br>import org.springframework.stereotype.Service;<br><br>@Service<br>@RequiredArgsConstructor<br>@Slf4j<br>public class Service {<br>    private final RedisLock redisLock;<br>    private final EmployeeRepo employeeRepo;<br><br>    public void addEmployee(Employee employee) {<br>        if (redisLock.tryLock()) {<br>            log.info(&quot;Lock&quot;);<br>            try {<br>                log.info(&quot;Employee name &quot; + employee.getName());<br>                if (employee.getEmail() != null) {<br>                    Employee oldEmployee = employeeRepo.findByEmail(employee.getEmail());<br>                    if (oldEmployee == null) {<br>                        employeeRepo.add(employee);<br>                    } else {<br>                        log.error(oldEmployee.getEmail() + &quot; is already present&quot;);<br>                    }<br>                }<br>            } finally {<br>                log.info(&quot;Lock Released&quot;);<br>                redisLock.unlock();<br>            }<br>        } else {<br>            log.error(&quot;lock is acquired by another thread&quot;);<br>        }<br>    }</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=797f4c8b32a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices Security]]></title>
            <link>https://medium.com/@omerfarukicen/microservices-security-5a46d3ec02e8?source=rss-904821088192------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a46d3ec02e8</guid>
            <dc:creator><![CDATA[ÖMER FARUK İÇEN]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 13:19:09 GMT</pubDate>
            <atom:updated>2023-11-11T13:20:49.207Z</atom:updated>
            <content:encoded><![CDATA[<p>Microservices architecture has gained popularity in recent years due to its scalability, flexibility, and the ability to streamline software development. However, this distributed approach brings about unique security challenges that need to be addressed to ensure the protection of your systems and data. In this article, We will examine the API gateway security solution for microservices.</p><p><strong>Microservice Security Issues:</strong><br><strong>1.Increased Attack Surface: </strong>Instead of a couple of entry points, as in a monolithic application, now you have a large number of entry points. As the number of entry points to the system increases, the attack surface broadens too.</p><p><strong>2. Security Expertise: </strong>Since security solutions will be created in each microservice, there will need to be someone in the microservice team who leaves this job.Due to the technology independence of microservices, you will need to develop the same protocols everywhere.</p><p><strong>3.Scaling Challenges: </strong>Since each microservice talks to the authorization server for token validation, when you scale your<br>microservice that will also increase the number of connections to the authorization server.</p><p><strong>4.Isolation of Microservices</strong><br>Microservices architecture breaks application components into small, independent services.When we can manage authentication and authorization processes through the service, dependencies occur.</p><p><strong>5. Observability :</strong></p><p>Aggregating a set of logs can produce metrics. In a way, metrics reflect the state of the system. In terms of security, the average invalid access requests per hour is a metric, for example. If the number is high, it probably indicates that the system is under attack or the first-level defense is weak. You can configure alerts based on metric</p><p>API Gateway can help in this regard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*MtR6U1IQDT_fF5w0NmVfdA.jpeg" /></figure><p>API Gateway, Auth Server, and Client applications are the fundamental components of a common model for managing security and authentication in modern software applications. These components come together to centralize user authentication and authorization processes, ensuring their security. Here’s a brief overview of how these components work:</p><ol><li>Auth Server (Authentication Server): The Auth Server is a central service used to authenticate and authorize user identities. It manages users, implements authentication protocols, and controls user access rights. It can use protocols such as OAuth 2.0 or OpenID Connect, for example.</li><li>Client: The Client represents the user’s access requests to the Auth Server. The Client can be an application that provides a user interface, such as a web browser, a mobile app, or a desktop application.</li><li>API Gateway: The API Gateway serves as an intermediary between the Client and the target service (e.g., a microservice or a database). It routes and processes incoming requests, verifies authorization processes, and directs them to target services. Additionally, the API Gateway provides a single access point for clients and enforces security measures.</li></ol><p>When these components come together, they follow the following basic flow:</p><ol><li>The Client wants to access a resource (e.g., a web page or an API).</li><li>The Client makes a request to the Auth Server to obtain an authentication or access token.</li><li>The Auth Server verifies the Client’s authentication and authorization and provides an access token or an authentication ticket.</li><li>The Client uses this access token or authentication ticket to access the API Gateway.</li><li>The API Gateway verifies incoming requests and performs authorization. It then routes requests to the appropriate target services.</li><li>The target service processes the request and returns the result to the API Gateway.</li><li>The API Gateway forwards the result to the Client, allowing access to the desired resource.</li></ol><p>This model provides secure and centralized authentication and access control. The Auth Server keeps user information secure and effectively manages authentication processes. The API Gateway securely routes incoming requests and enforces security policies of the target services, ensuring that applications operate securely and reliably.</p><p>In this article, we’ve explored some of the OAuth 2.0 security patterns and how to implement them using Spring Cloud Gateway. As usual, all code is available</p><p><a href="https://github.com/omerfarukicen/secure-gateway">GitHub - omerfarukicen/secure-gateway</a></p><p><a href="https://github.com/microservices-security-in-action">https://github.com/microservices-security-in-action</a></p><p><a href="https://www.baeldung.com/spring-cloud-gateway-oauth2">https://www.baeldung.com/spring-cloud-gateway-oauth2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a46d3ec02e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>