<?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 Long Vu on Medium]]></title>
        <description><![CDATA[Stories by Long Vu on Medium]]></description>
        <link>https://medium.com/@rianvu?source=rss-29c8c728ab7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lOMe60gqKcUeK-Har0J13w.jpeg</url>
            <title>Stories by Long Vu on Medium</title>
            <link>https://medium.com/@rianvu?source=rss-29c8c728ab7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:52:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rianvu/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[A load balancer story in the real world]]></title>
            <link>https://rianvu.medium.com/a-load-balancer-story-in-the-real-world-74235e07a6fa?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/74235e07a6fa</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[load-balancer]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Thu, 28 Nov 2024 17:22:11 GMT</pubDate>
            <atom:updated>2024-11-29T01:48:57.980Z</atom:updated>
            <content:encoded><![CDATA[<p>A resort has recently opened, showcasing magnificent mountains and beach views.</p><p>In the first month, the resort served 5 to 10 tourists daily, so the owner hired only one front desk agent responsible for registering and supporting customer needs. Because the number of tourists was relatively small and didn’t require serving all at once, the check-in/check-out process executed smoothly without claims.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*1zRTMBVkjTWVJEEuCH4i6w.png" /></figure><p>In the second month, the marketing team runs a campaign and makes customers an offer they can’t turn down. Many booking calls come to the resort in a flash. Many tourists check in simultaneously one day, and a single front desk agent is overloaded with a long waitlist. Customer complaints are becoming alarming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*8BhCCSvHuvjv_okXnifxvw.png" /></figure><p>Managers stepped in quickly and commanded to add new desks to serve customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*Lgzb7IgYEw0k-4SZLsqt0Q.png" /></figure><p><strong>Manager:</strong> We need people to guide and navigate customers to their desks to ensure that the desks serve customers at their maximum capacity.</p><p>The manager hires a line coordinator to support customers.</p><p><strong>Line coordinator: </strong>…, but, manager, how should I divide customers to each desk?</p><p><strong>Manager:</strong> Thinking….! Let’s start with the <strong><em>round-robin method</em></strong>. Direct customers to the service desk one after another, beginning with the first desk and continuing to the last.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*3s4FF8K64Vyt8shGlGVCNg.png" /></figure><p><strong>Line coordinator:</strong> I see the employee at desk 3rd processes faster than the rest. Should we add customers to line 3 more than at other desks?</p><p><strong>Manager:</strong> Why not? You can use the <strong><em>weighted round-robin method </em></strong>that allows you to add customer numbers to each desk differently based on employee at-desk performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*GmNS_a0laTJ6l6UadYa-tw.png" /></figure><p><strong>Line coordinator:</strong> We have VIPs coming, sir! Which desk serves them now?</p><p><strong>Manager:</strong> You should guide the VIPs to the VIP line(a kind of <strong><em>IP hash method</em></strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*xRYjMURHD4BdK92IBd6TXQ.png" /></figure><p><strong>Line coordinator:</strong> Sir, we have a problem. The employee at desk 2 served the customer, and the line is empty now, while I just set the next customer to desk 3. Should I continue with the round-robin to desk 4?</p><p><strong>Manager:</strong> Another method allows you to be flexible but requires more work. Before assigning a customer to a desk, you need to review the number of customers in line at all desks, find the desk with the fewest customers, and then navigate the next customer to go there (<strong><em>Least connection method</em></strong>).</p><p><strong>Manager:</strong> Use the above method but with upper performance. You can observe and know the exact employee performance at each desk, and then you can arrange the number of customers differently between each desk(<strong><em>Weighted least connection method</em></strong>).</p><p><strong>Line coordinator:</strong> That’s interesting! However, I noticed that customers have different needs regarding service. Some people check in quickly, while others want to take their time to ask for more information about the resort’s services. Also, some guests are checking out, requiring more time to inspect the room. How should we handle these?</p><p><strong>Manager:</strong> Hmmm, it seems more complicated. You need to ask the customer about their needs, coordinate with each desk to determine the processing durations, and finally pick the desk with the least time for the customer(<strong><em>Least response time method</em></strong>).</p><p><strong>Line coordinator: </strong>I got it. Thank you, sir!</p><p><strong>Manager: </strong>No problem. I hope you do your job to the best of your ability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74235e07a6fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate a legacy service into a new system]]></title>
            <link>https://rianvu.medium.com/how-to-integrate-a-legacy-service-into-a-new-system-60b9fcdcb306?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/60b9fcdcb306</guid>
            <category><![CDATA[anti-corruption]]></category>
            <category><![CDATA[legacy-systems]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Wed, 27 Nov 2024 03:13:14 GMT</pubDate>
            <atom:updated>2024-11-27T03:13:14.248Z</atom:updated>
            <content:encoded><![CDATA[<p>Many legacy services continue to operate alongside new services, interacting seamlessly within a system despite being built in different programming languages and lacking shared data semantics. So, how can these services communicate effectively without modifying the legacy systems?</p><p>We can use the anti-corruption layer pattern, which is a middle layer between legacy services and new systems. It transforms data to ensure services understand and use it properly, handle errors, validate data, and collect data logging.</p><p>This is an example of data flow using an anti-corruption layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWgZl5NgnQWiGoe2PILj3Q.png" /></figure><p>We set up logical transformations between new system data and legacy data, which will increase response time and latency, make the system more complex to maintain, and require more effort to scale.</p><p>We use this pattern only when we have legacy services that need to work with a new system and don’t have the option to replace them soon. In other cases, if we have two or more services with different data semantics, they need to interact together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60b9fcdcb306" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ambassador and sidecar patterns]]></title>
            <link>https://rianvu.medium.com/ambassador-and-sidecar-patterns-in-microservices-e4ed70e01a50?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4ed70e01a50</guid>
            <category><![CDATA[sidecar-pattern]]></category>
            <category><![CDATA[ambassador]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Tue, 26 Nov 2024 16:32:32 GMT</pubDate>
            <atom:updated>2024-11-26T16:50:16.089Z</atom:updated>
            <content:encoded><![CDATA[<p>We have an application that interacts with several external services. We aim to monitor its health and collect logs and metrics while allowing the application to focus on its core business logic. To achieve this, we plan to use a proxy to communicate with external services(Ambassador pattern). Additionally, we will implement another proxy to manage logging, data metrics collection, and overall application health monitoring(Sidecar pattern).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-oixLoNxN4YYGpzX4niuDw.png" /></figure><p>As you can see, the ambassador and sidecar containers are separated and hosted on the same host with an application.</p><p>Data flow through ambassador and sidecar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tClPBwffV563ST0vCP8Zg.png" /></figure><p>What standard components are in an ambassador container, and how do they interact?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0O0EbzUT8O4Bfcw9gelNg.png" /></figure><pre><strong>Load Balancer:</strong><br>- Distributes requests across multiple service instances<br>- Implements routing strategies (round-robin, weighted, etc.)<br>- Handles traffic management<br><br><br><strong>Service Discovery:</strong><br>- Maintains registry of available services<br>- Tracks service health and availability<br>- Updates service endpoints dynamically<br><br><br><strong>Circuit Breaker:</strong><br>- Prevents cascading failures<br>- Monitors service health<br>- Trips when error threshold reached<br>- Implements fallback mechanisms<br><br><br><strong>Retry Handler:</strong><br>- Manages retry attempts for failed requests<br>- Implements backoff strategies<br>- Handles temporary failures gracefully<br><br><br><strong>SSL/TLS Termination:</strong><br>- Manages secure connections<br>- Handles certificates<br>- Encrypts/decrypts traffic<br><br><br><strong>Response Cache:</strong><br>- Caches frequent responses<br>- Reduces external calls<br>- Improves response time<br><br><br><strong>Monitoring/Telemetry:</strong><br>- Tracks system metrics<br>- Monitors service health<br>- Provides debugging information</pre><p>What standard components are in a sidecar container, and how do they interact?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQfLaqXmJatIOVuam5i-rw.png" /></figure><pre><strong>Logging Sidecar:</strong><br>- Log Collection: Captures application logs<br>- Log Processing: Formats and enriches logs<br>- Log Rotation: Manages log file sizes<br>- Log Shipping: Sends logs to central storage<br><br><br><strong>Metrics Sidecar:</strong><br>- Metrics Collection: Gathers application metrics<br>- Metrics Aggregation: Processes and summarizes metrics<br>- Alert Management: Monitors thresholds and triggers alerts<br>- Metrics Storage: Sends to time-series database<br><br><br><strong>Config Sidecar:</strong><br>- Config Watching: Monitors for configuration changes<br>- Config Validation: Ensures config integrity<br>- Config Distribution: Updates application with new configs<br>- Version Management: Tracks config versions<br><br><br><strong>Security Sidecar:</strong><br>- Certificate Management: Handles SSL/TLS certificates<br>- Secrets Management: Manages sensitive data<br>- Policy Enforcement: Implements security policies<br>- Authentication: Handles identity verification</pre><p>Along with the benefits, we should also think about some disadvantages before applying.</p><pre><strong>Ambassador:</strong><br>  Performance Impact:<br>  - Adds extra network hop causing increased latency<br>  - Consumes additional memory and CPU for proxying<br>  - Can become a bottleneck under high load<br>  <br>  Complexity:<br>  - Complex configuration for service discovery and load balancing<br>  - Difficult to debug network issues across multiple hops<br>  - Challenging to maintain in multiple environments<br>  <br>  Resource Cost:<br>  - Requires dedicated resources for each ambassador<br>  - Higher infrastructure costs<br>  - Additional monitoring overhead<br><br><strong>Sidecar:</strong><br>  Resource Overhead:<br>  - Each sidecar container adds CPU/memory overhead<br>  - Multiple containers share limited pod resources<br>  - Higher overall infrastructure cost<br>  <br>  Operational Complexity:<br>  - Difficult container lifecycle management<br>  - Complex inter-process communication<br>  - Harder to debug issues between containers<br>  <br>  Maintenance:<br>  - Version compatibility challenges between app and sidecars<br>  - More complex testing and deployment<br>  - Multiple components to monitor and maintain</pre><p>When to avoid these patterns:</p><pre><strong>Simple Applications:</strong><br>- Single service applications with basic needs<br>- Low traffic systems<br>- MVP or prototype development<br>- Limited operational resources<br><br><strong>Resource Constraints:</strong><br>- Limited infrastructure budget<br>- Small development team<br>- Basic deployment requirements</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4ed70e01a50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Organize a large team effectively]]></title>
            <link>https://rianvu.medium.com/how-to-take-the-initiative-to-manage-a-large-team-effectively-97b69ce536ec?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/97b69ce536ec</guid>
            <category><![CDATA[team-management]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Tue, 26 Nov 2024 09:33:08 GMT</pubDate>
            <atom:updated>2024-11-26T09:34:26.220Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is the difference between managing a small team and a large team?</strong></p><p>As a manager, it is essential to work closely with your team. Monitor team dynamics and identify issues, determining whether to resolve them yourself or let the team handle them. Provide timely feedback to coach your members and act as a mentor to help them enhance their skills and abilities.</p><p>In a small team with fewer than ten members, a manager can hold weekly one-on-one meetings with junior staff and bi-weekly sessions with senior members, promoting a clear understanding of their satisfaction. However, in a larger team of 30 to 40 members, maintaining productivity, high standards, and team motivation becomes difficult due to the limited time available for individual engagement.</p><p>In a small team, you focus on limited scopes and specific parts of a system, allowing you to understand in detail the processes and logic behind each task your team members undertake. In contrast, with a larger team, you must manage broader, cross-functional scopes while dealing with time constraints.</p><p><strong>How to organize a large team productively?</strong></p><p>This is the structure of a military organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2sJ-esDATow1mSghMtHMOQ.png" /></figure><p>A squad is the smallest unit in the organization. When members exceed the limit, a new unit is created until the maximum level is reached. Each unit has a leader who manages members and reports statistics to the higher leader.</p><p>If ten people report to you, you’re a squad lead. A platoon lead manages 1 to 3 squads, with 3 direct reports overseeing 16–44 members. The platoon leader executes and observes through 3 squad leaders instead of working closely with each member.</p><p><strong>Stepping up in management requires defining norms, strategizing, planning for your unit, and daily monitoring.</strong></p><ul><li>Define positions explicitly and responsibilities so that every member knows exactly what to do.</li><li>Define the way of working; it serves as a guideline to help members collaborate effectively with others in the unit.</li><li>The boundary of the unit’s scope should be kept clean to avoid overlap of responsibility. This way, unit leaders can make decisions quickly or request help from another unit if needed.</li><li>Organize the documents centrally, store all documents related to the units, and ensure every member knows where to find a document quickly when needed. Like GitLab, they create an employee handbook and include everything in it.</li><li>Define and share the unit planning with every member. Clearly outline the goals, explain why we have them, and demonstrate their impacts to inspire the unit mission for every member.</li><li>Set up a monitoring system to assess all units’ system health and performance. Each unit leader must manage their scope and be hands-on whenever an issue arises.</li><li>Set a schedule to meet 1:1 with the unit leaders, sync up on the unit status, and provide timely feedback to encourage all units to proceed together.</li><li>Request the unit leaders to prepare and book sharing sessions for the entire unit; this will highlight the unit’s achievements and challenges, including lessons learned, to help every member avoid similar issues in the future.</li><li>Set performance reviews in a timely manner to evaluate unit and member performance and propose improvement plans.</li><li>Set skip-level meetings allow you to hold 1:1 sessions with any members in your unit, aiming to understand their status, what they need, and what problems they have. You can then sync up with their manager to improve the process.</li></ul><p>The above is just an internal unit organization; you must also manage stakeholders as a manager. In this post, I mention the unit organization for large teams; the next post will dive into stakeholder management.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97b69ce536ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rule of thirds in software development]]></title>
            <link>https://rianvu.medium.com/rule-of-thirds-in-software-development-de2fdbd1de41?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/de2fdbd1de41</guid>
            <category><![CDATA[delivery-management]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[management-software]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 05:04:23 GMT</pubDate>
            <atom:updated>2024-11-22T05:04:23.317Z</atom:updated>
            <content:encoded><![CDATA[<p>As software engineers, we often face bugs while developing features that stem from poor solution design, unexpected edge cases, or misunderstandings of business requirements. These issues arise primarily when software engineers and their teams need to conduct thorough reviews and analyses before jumping into implementation. By adhering to the “rule of thirds” and bringing up concerns with managers to clarify any uncertainties, teams can avoid many problems, save valuable time, and contribute to timely releases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*fHTy-0IEUXrycsOkHtZQWw.png" /></figure><p>The rule of thirds divides a development process into three phases: design, implementation, and testing.</p><ul><li>Design: Review and analyze business requirements; identify uncertain aspects that need clarification; list relevant participants, features that will be impacted, and features that are dependent on them; define non-requirements such as performance, security, and system resilience; set measure metrics, define technical solutions and flows, and implement a plan, testing plan, and monitoring plan.</li><li>Implementation: Following the schedule and plan for the design part, implement the solution and flow detail at a low level.</li><li>Testing: Verify code quality, implement unit tests, execute test scripts, perform integration testing, or perform any other kind of test that follows the testing plan on the design part.</li></ul><p>Which is the most essential part of those?</p><p>I like a quote by Albert Einstein.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*qbB4zMxWhjx5XqCTyYeNlQ.jpeg" /></figure><p>, and another quote from Abraham Lincoln.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*miq4raNgmTWfGHY8ihtKRA.jpeg" /></figure><p>If we think thoroughly and prepare for an issue, we can solve it effectively.</p><p>As managers, we must ensure that our engineers have sufficient time to concentrate on the design phase. All preparations should be documented and thoroughly reviewed by the entire team. Additionally, we should encourage every team member to ask questions and discuss their concerns rather than simply agreeing with the majority and leaving hidden risks unaddressed.</p><p>Some engineers often ask managers why it is necessary to create documents, claiming that it takes too much of their time and is less valuable to them. However, documents serve not only as a means for engineers to review requirements and carefully consider solutions but also as a crucial tool for managers to identify risks. This documentation ultimately helps the entire team deliver the product with high quality and on time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de2fdbd1de41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance testing]]></title>
            <link>https://rianvu.medium.com/performance-testing-8ea4d7ad597d?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ea4d7ad597d</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[scalibility-testing]]></category>
            <category><![CDATA[volume-testing]]></category>
            <category><![CDATA[stress-testing]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 05:12:39 GMT</pubDate>
            <atom:updated>2024-11-18T14:50:02.473Z</atom:updated>
            <content:encoded><![CDATA[<p>Performance testing is a critical aspect of software evaluation that assesses how well a system operates under different workload conditions. This type of testing focuses on key metrics such as response time, throughput, resource usage, and stability to ensure the system can handle expected and peak user demands. By simulating various scenarios, including high traffic loads and simultaneous user interactions, performance testing helps identify potential bottlenecks and weaknesses in the system, allowing developers to optimize performance and enhance user experience.</p><p>In this post, we will focus on standard testing methods rather than reviewing all types of testing.</p><p><strong>Load testing</strong></p><pre><strong>Tasks:</strong><br>- Run tests with gradually increasing users/requests<br>- Monitor response time and resource usage<br>- Identify system breaking points<br>- Test main business flows<br><br><br><strong>Purpose:</strong><br>- Evaluate system performance under normal and peak loads<br>- Determine system limitations<br>- Ensure system meets SLA requirements<br><br><br><strong>Success Metrics:</strong><br>- Response time &lt; x seconds (according to SLA)<br>- Throughput achieves y requests/second<br>- Error rate &lt; z%<br>- CPU/Memory usage &lt; threshold</pre><ul><li>Testing flow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v0QL41iOkg6gBR14HbXp_w.png" /></figure><ul><li>Examples of some tools/libraries.</li></ul><pre>JMeter: Test scripting &amp; execution<br>K6: Modern load testing tool<br>Gatling: High-scale load testing<br>Grafana + Prometheus: Monitoring<br>ELK Stack: Log analysis</pre><p><strong>Stress testing</strong></p><pre><strong>Tasks:</strong><br>- Test with load exceeding capacity<br>- Test with sudden spike traffic<br>- Test recovery after overload<br><br><br><strong>Purpose:</strong><br>- Evaluate stability under high pressure<br>- Test recovery capability<br>- Identify system weaknesses<br><br><br><strong>Success Metrics:</strong><br>- No system crashes<br>- Recovery time &lt; x minutes<br>- No data loss<br>- Graceful degradation</pre><ul><li>Testing flow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIcNcw0wChNQF9TMqHHm6g.png" /></figure><ul><li>Examples of some tools/libraries.</li></ul><pre>Apache AB: HTTP stress testing<br>Locust: Python-based stress testing<br>Siege: HTTP stress testing<br>Chaos Monkey: Failure injection<br>Datadog: Advanced monitoring</pre><p><strong>Endurance/Stability Testing</strong></p><pre><strong>Tasks:</strong><br>- Run continuous tests for extended periods (24h+)<br>- Monitor memory usage and performance<br>- Check for memory leaks<br><br><br><strong>Purpose:</strong><br>- Evaluate long-term stability<br>- Detect memory leaks<br>- Monitor resource usage over time<br><br><br><strong>Success Metrics:</strong><br>- No memory leaks<br>- Stable performance<br>- No degradation<br>- Meets uptime requirements</pre><ul><li>Testing flow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsN9qF_2YDEmss_M_P8zVQ.png" /></figure><ul><li>Examples of some tools/libraries.</li></ul><pre>Marathon: Long-running tests<br>AppDynamics: Performance monitoring<br>New Relic: Resource tracking<br>DynaTrace: Memory analysis<br>VisualVM: Memory profiling</pre><p>Scalability Testing</p><pre><strong>Tasks:</strong><br>- Test with scaling up/out resources<br>- Evaluate auto-scaling effectiveness<br>- Test performance with additional nodes<br><br><br><strong>Purpose:</strong><br>- Verify scalability capabilities<br>- Evaluate efficiency of adding resources<br>- Optimize scaling configuration<br><br><br><strong>Success Metrics:</strong><br>- Linear scaling ratio<br>- Auto-scaling time &lt; x minutes<br>- Performance increases proportionally with resources</pre><ul><li>Testing flow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hARu1LJyjWcqwHTgwuhicA.png" /></figure><ul><li>Examples of some tools/libraries.</li></ul><pre>AWS CloudWatch: Auto-scaling monitoring<br>Azure Monitor: Scale metrics<br>Terraform: Infrastructure scaling<br>Kubernetes: Container orchestration<br>Prometheus: Metrics collection</pre><p><strong>Volume Testing</strong></p><pre><strong>Tasks:</strong><br>- Test with large data sets<br>- Check database performance<br>- Test file uploads/downloads<br><br><br><strong>Purpose:</strong><br>- Evaluate big data processing<br>- Check storage capacity<br>- Test I/O operations<br><br><br><strong>Success Metrics:</strong><br>- Query time &lt; x seconds<br>- Backup/restore time meets requirements<br>- Optimized storage usage</pre><ul><li>Testing flow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qIzbLynWiRu9DgYpJuxPSw.png" /></figure><ul><li>Examples of some tools/libraries.</li></ul><pre>Faker: Test data generation<br>DBMonster: Database load testing<br>pgbench: PostgreSQL benchmarking<br>Cassandra Stress: NoSQL testing<br>YCSB: Database benchmarking</pre><p><strong>Integrated Performance Testing Flow</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lRzbJ13LxID_fEQtmVcfuA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ea4d7ad597d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Service mesh]]></title>
            <link>https://rianvu.medium.com/service-mesh-a5be36b5719a?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5be36b5719a</guid>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[sidecar-pattern]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 16:25:28 GMT</pubDate>
            <atom:updated>2024-11-17T16:25:28.803Z</atom:updated>
            <content:encoded><![CDATA[<p>A service mesh is an infrastructure layer that manages communication between services in microservices architectures.</p><p><strong>Core components</strong></p><ul><li>Data plane</li></ul><pre>Sidecar Proxies (e.g., Envoy, Linkerd-proxy)<br>- Traffic Management: Load balancing, rate limit, Traffic splitting/shifting, Retry policies &amp; Timeouts, Circuit breaking<br>- Security: mTLS encryption, Authentication, Authorization, Certificate management<br>- Observability: Metrics collection, Distributed tracing, Access logging, Health checks</pre><ul><li>Control plane</li></ul><pre>Configuration Management<br>- API Server: Config validation, Config distribution, Version control.<br>- Service Discovery: Service registry, Load balancer config, Endpoint health tracking<br>- Policy Management: Traffic policies, Security policies, Rate limit policies</pre><p>How it interacts with other services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYKOwaIu-A04sq9fcx-B0A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5be36b5719a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Circuit breaker pattern]]></title>
            <link>https://rianvu.medium.com/circuit-breaker-pattern-a85dfd3bbd29?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a85dfd3bbd29</guid>
            <category><![CDATA[resilient]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 15:48:20 GMT</pubDate>
            <atom:updated>2024-11-17T15:48:20.129Z</atom:updated>
            <content:encoded><![CDATA[<p>The Circuit Breaker pattern works like an electrical circuit breaker by stopping interactions between services when it detects a high rate of failures, such as timeouts or server overloads. This interruption allows the failing service to recover while maintaining overall system stability.</p><p>The pattern has three stages: Closed, Open, and half-open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCCO_Q_VTRgpaTAndGjImA.png" /></figure><p><strong>How it work</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-TF3BHoJU27eghtOjnfK3g.png" /></figure><p><strong>In which locations is a circuit breaker implemented?</strong></p><ul><li>Microservices: Be implemented in the API gateway layer to manage downstream services and all circuit breaker policies. <br>Example: Kong Gateway, Netflix Zuul + Hystrix</li></ul><pre>[Client] → [API Gateway + Circuit Breaker] → [Microservices]</pre><ul><li>Service to service: Be implemented in each service to protect external service calls.<br>Libraries: resilient4j, Hystrix, Opossum, Polly, etc.</li></ul><pre>[Service A] → [Circuit Breaker] → [Service B]</pre><ul><li>Database Layer: Be implemented in the database layer to protect against database overload and handle connect pooling issues.</li></ul><pre>[Service] → [Circuit Breaker] → [Database]</pre><ul><li>Infrastructure Layer: Be implemented in a service mesh(example: Istio) to manage traffic and resilient patterns.</li></ul><pre>[Services] → [Service Mesh + Circuit Breaker] → [External Services]</pre><p><strong>Key best practices for circuit breaker.</strong></p><pre><strong>Configuration:</strong><br><br>One circuit breaker per dependency<br>Set proper timeout values<br>Configure failure thresholds wisely<br>Set appropriate recovery time<br><br><br><strong>Fallback:</strong><br><br>Always have a fallback plan<br>Use cached data when possible<br>Return sensible default values<br>Handle partial failures<br><br><br><strong>Monitoring:</strong><br><br>Track circuit states<br>Monitor failure rates<br>Set up alerts<br>Log important events<br><br><br><strong>Testing:</strong><br><br>Test all states (Open/Closed/Half-Open)<br>Test failure scenarios<br>Verify fallback behavior<br>Include in CI/CD<br><br><br><strong>Implementation:</strong><br><br>Keep it simple<br>Use proven libraries<br>Separate from business logic<br>Document configurations</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a85dfd3bbd29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Key management system]]></title>
            <link>https://rianvu.medium.com/key-management-system-c17616de13df?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c17616de13df</guid>
            <category><![CDATA[key-energy-services]]></category>
            <category><![CDATA[hms]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 08:33:17 GMT</pubDate>
            <atom:updated>2024-11-17T13:50:51.124Z</atom:updated>
            <content:encoded><![CDATA[<p>We utilize a master key and a key reference system to ensure the security of the key.</p><p><strong>Master key</strong></p><ul><li>The root of the key hierarchy</li><li>Stored securely in HSM/KMS</li><li>Used to protect other keys</li><li>Never leaves secure hardware</li><li>The foundation of key security system</li></ul><pre>class MasterKeySystem:<br>    def __init__(self):<br>        self.hsm = HSMClient()<br>    <br>    def create_master_key(self):<br>        # Master Key created and stored in HSM<br>        master_key_id = self.hsm.generate_master_key()<br>        return master_key_id<br>    <br>    def encrypt_data_key(self, data_key):<br>        # Encrypt actual encryption key using master key<br>        master_key = self.hsm.get_master_key()<br>        encrypted_key = encrypt(data_key, master_key)<br>        <br>        # Return reference to encrypted key<br>        return {<br>            &#39;key_id&#39;: generate_uuid(),<br>            &#39;encrypted_key&#39;: encrypted_key<br>        }</pre><pre>1. Security:<br>   - Actual keys never stored in application/database<br>   - Keys protected by hardware security<br>   - Limited exposure of sensitive key material<br><br>2. Management:<br>   - Centralized key control<br>   - Easier key rotation<br>   - Better audit tracking<br>   - Simplified access control</pre><p><strong>Key Reference</strong></p><ul><li>Pointer/identifier to encrypted keys</li><li>Contains metadata about the key</li><li>Stored in database</li><li>It doesn’t contain actual key material</li><li>Used to track and manage keys</li></ul><pre>class KeyReferenceSystem:<br>    def generate_data_key(self):<br>        # 1. Generate actual data key<br>        data_key = os.urandom(32)<br>        <br>        # 2. Encrypt with master key<br>        encrypted_key = self.encrypt_with_master_key(data_key)<br>        <br>        # 3. Store reference in database<br>        key_reference = {<br>            &#39;key_id&#39;: uuid.uuid4(),<br>            &#39;encrypted_key&#39;: encrypted_key,<br>            &#39;created_at&#39;: datetime.now(),<br>            &#39;status&#39;: &#39;active&#39;<br>        }<br>        <br>        return key_reference<br><br>    def use_key_reference(self, key_reference):<br>        # 1. Get encrypted key from reference<br>        encrypted_key = key_reference[&#39;encrypted_key&#39;]<br>        <br>        # 2. Decrypt using master key from HSM<br>        data_key = self.decrypt_with_master_key(encrypted_key)<br>        <br>        # 3. Use key for operation but never store<br>        return data_key</pre><p>How it work</p><pre>1. Key Creation:<br>   Master Key (HSM) → Encrypts Data Key → Store Key Reference<br><br>2. Key Usage:<br>   Get Reference → Use Master Key → Decrypt Data Key → Use → Wipe<br><br>3. Key Rotation:<br>   New Key → Encrypt with Master → Update Reference → Retire Old</pre><pre>1. Database Encryption:<br>   Master Key → TDE Key → Data Encryption<br><br>2. Application Data:<br>   Master Key → Application Keys → Data Keys<br><br>3. Storage:<br>   Master Key → Volume Keys → Sector Keys</pre><pre>class EncryptionService:<br>    def encrypt_sensitive_data(self, data):<br>        try:<br>            # 1. Get key reference from database<br>            key_ref = self.db.get_key_reference(&#39;active_key&#39;)<br>            <br>            # 2. Get master key from HSM<br>            master_key = self.hsm.get_master_key()<br>            <br>            # 3. Decrypt the data key<br>            data_key = decrypt(<br>                key_ref[&#39;encrypted_key&#39;], <br>                master_key<br>            )<br>            <br>            # 4. Use data key to encrypt data<br>            encrypted_data = encrypt(data, data_key)<br>            <br>            # 5. Clear data key from memory<br>            self.secure_wipe(data_key)<br>            <br>            return encrypted_data<br>            <br>        except Exception as e:<br>            log.error(f&quot;Encryption failed: {str(e)}&quot;)<br>            raise</pre><pre>class KeyRotation:<br>    def rotate_keys(self):<br>        # 1. Generate new data key<br>        new_data_key = os.urandom(32)<br>        <br>        # 2. Encrypt with current master key<br>        encrypted_key = self.encrypt_with_master_key(new_data_key)<br>        <br>        # 3. Create new reference<br>        new_reference = {<br>            &#39;key_id&#39;: uuid.uuid4(),<br>            &#39;encrypted_key&#39;: encrypted_key,<br>            &#39;created_at&#39;: datetime.now()<br>        }<br>        <br>        # 4. Update database<br>        self.update_key_reference(new_reference)</pre><p>KMS interacts with multiple-layer flow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BpVTQXYzQnIUkEvokrH-kA.png" /></figure><p>KMS Tools</p><ul><li>HashiCorp Vault Enterprise</li></ul><pre>Strengths:<br>- Comprehensive key management<br>- Multi-layer encryption support<br>- Strong access control<br>- Excellent integration capabilities<br>- Auto key rotation<br>- Dynamic secrets<br>- API-driven<br>- High availability<br>- Disaster recovery<br><br>Layer Support:<br>- Application: ✓ API &amp; SDK support<br>- Transport: ✓ TLS certificate management<br>- Database: ✓ Database credential management<br>- Storage: ✓ Encryption as service</pre><ul><li>Thales CipherTrust Manager</li></ul><pre>Strengths:<br>- Enterprise-grade security<br>- FIPS 140-2 certified<br>- Comprehensive key lifecycle<br>- Multi-cloud support<br>- Centralized management<br>- Strong compliance features<br><br>Layer Support:<br>- Application: ✓ API integration<br>- Transport: ✓ SSL/TLS management<br>- Database: ✓ Database encryption<br>- Storage: ✓ Storage encryption</pre><p>For example, Vault interacts with multiple-layer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BFmYnR_PzXrtUmYAO1dolA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c17616de13df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multiple encryption layers]]></title>
            <link>https://rianvu.medium.com/enhanced-encryption-with-multiple-layers-aa80fb8a0307?source=rss-29c8c728ab7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa80fb8a0307</guid>
            <category><![CDATA[multiple-layer-encryption]]></category>
            <category><![CDATA[data-leak]]></category>
            <category><![CDATA[aes256]]></category>
            <category><![CDATA[data-encryption]]></category>
            <dc:creator><![CDATA[Long Vu]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 09:01:06 GMT</pubDate>
            <atom:updated>2024-12-12T04:13:55.429Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Encryption Layers</strong></p><p>We identify four layers: application, transport, database, and storage. Encrypting specific objects and data at each layer is essential to prevent vulnerabilities that attackers could exploit.</p><p><strong>Application layer encryption</strong></p><ul><li>The application layer must manage column encryption, data masking, and application keys.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LuderHFs9mn3laZnkYgmgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kIQ2_NHbD2L1tmwMlCaB6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Y94vNG8NvSfOKS9QFTmnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eL6a4ngeqIevxoPzgIetwQ.png" /></figure><p><strong>Transport layer encryption</strong></p><ul><li>We manage SSL/TLS, certificate management, and session keys at the transport layer.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CR38nIcP2K_vsq98RPe67g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NC7GbSVcJZ_l87nRKNm1iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4RSsKoiBDNxofQtcoGrphQ.png" /></figure><p><strong>Database layer encryption</strong></p><ul><li>Dig deeper into the database, we have Transparent Data Encryption, Key Management, and Access Control.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcbSB9r78mFRyLwErRAH3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8jioY6m_YMHfXqh573NzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlm-uomu50WRkCwtGedEbA.png" /></figure><p><strong>Storage layer encryption</strong></p><ul><li>In the final layer, we manage File System Encryption, Backup Encryption, and Key Storage at the storage layer.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CElPfRcNdGhss7yNyS3HJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*349NuabPkHbup6ByzYyzbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBh7Xu5Ng9toq7Z43pQWTQ.png" /></figure><ul><li>We must enhance our access level management by defining role-based permissions, ranging from basic users to super admins. Each higher role should oversee the roles and permissions of lower levels in a hierarchical structure.</li><li>Additionally, we should establish dynamic roles and implement temporary permissions based on specific contexts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzUwhAuyUN-vrBPX8A7grg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c57nlvVzVHUrRM9yLjbByQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUSD25qgqrXYRldpOtnXFQ.png" /></figure><p><strong>Encryption algorithms</strong></p><ul><li>Depending on data sense in a specific layer, we have some algorithms that fit with it: AES-256 is used for TDE, Deterministic AES is tailored to database columns, and Randomized AES fits sensitive fields. Etc.</li><li>Each algorithm has pros and cons; we must trade-offs when applying them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*43KXgSMvsB4pk6S7_NXHQA.png" /></figure><pre>AES-256:<br>- Encrypts entire database at disk level<br>- Transparent to applications (no code changes needed)<br>- High performance with hardware acceleration<br>- Centralized key management<br>- Meets compliance requirements (HIPAA, PCI DSS)<br>- Comprehensive protection: data files, logs, backups</pre><pre>Deterministic AES:<br>- Enables searching on encrypted data<br>- Supports indexing<br>- Allows unique constraints<br>- Supports exact match queries<br>- Efficient for searchable fields (email, phone, SSN)<br>- Maintains data integrity with unique values</pre><pre>Randomized AES:<br>- Highest security for sensitive data<br>- Prevents pattern analysis<br>- Conceals identical data relationships<br>- Perfect for passwords and secrets<br>- Different ciphertext for each encryption<br>- Maximum protection against frequency attacks</pre><pre>XTS-AES:<br>- Specifically designed for disk encryption<br>- Supports random access to encrypted data<br>- Sector-level independence<br>- High performance for large storage systems<br>- Protection against data manipulation<br>- Suitable for filesystem-level encryption</pre><pre>AES-GCM:<br>- Combines encryption and authentication<br>- Built-in data integrity verification<br>- High performance for large datasets<br>- No padding required (reduces complexity)<br>- Detects tampering with encrypted data<br>- Efficient parallel processing support</pre><p>Encrypting data is crucial for securing information and preventing hackers. However, besides its benefits, it makes the system more complex, increases latency, and requires more maintenance effort.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa80fb8a0307" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>