<?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 Hanokh Aloni on Medium]]></title>
        <description><![CDATA[Stories by Hanokh Aloni on Medium]]></description>
        <link>https://medium.com/@hanokhaloni?source=rss-d52a6797efc3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0Z_WCxyZ2B1fM3Rf.</url>
            <title>Stories by Hanokh Aloni on Medium</title>
            <link>https://medium.com/@hanokhaloni?source=rss-d52a6797efc3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 06:18:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hanokhaloni/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[The 12 Factor App Development: Principles for Building Modern and Scalable Applications]]></title>
            <link>https://medium.com/@hanokhaloni/the-12-factor-app-development-principles-for-building-modern-and-scalable-applications-74d6a214c9f7?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/74d6a214c9f7</guid>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 13:51:03 GMT</pubDate>
            <atom:updated>2024-04-09T13:51:03.561Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced and dynamic digital landscape, developing applications that are scalable, maintainable, and resilient is crucial. The Twelve-Factor App methodology provides a set of best practices and principles that guide developers in building cloud-native applications. In this blog post, we will delve into the Twelve-Factor App development approach, exploring each factor and its significance in modern application development.</p><h3>Understanding the Twelve-Factor App Methodology</h3><ol><li>Codebase: Maintain a single codebase per application, allowing for version control, ease of collaboration, and simplifying deployment.</li><li>Dependencies: Explicitly declare and manage dependencies, ensuring consistent environments and avoiding dependency conflicts.</li><li>Config: Store configuration in environment variables, promoting flexibility and enabling easy configuration changes across different deployment environments.</li><li>Backing Services: Treat backing services (databases, queues, etc.) as attached resources, enabling easy replacement or scaling without code changes.</li><li>Build, Release, Run: Separate build, release, and run stages to promote reproducibility, scalability, and simplified deployment processes.</li><li>Processes: Execute the application as one or more stateless processes, facilitating scalability, fault tolerance, and rapid scaling.</li><li>Port Binding: Adhere to a port-binding approach, enabling applications to be self-contained and easily accessible through standardized network ports.</li><li>Concurrency: Scale the application horizontally by running multiple instances, enabling efficient resource utilization and improved performance.</li><li>Disposability: Embrace fast startup and graceful shutdown to ensure efficient scaling, fault tolerance, and easy application management.</li><li>Dev/Prod Parity: Keep development, staging, and production environments as similar as possible, minimizing surprises and easing deployment.</li><li>Logs: Treat logs as event streams, allowing for easy aggregation, analysis, and troubleshooting.</li><li>Admin Processes: Run administrative tasks as one-off processes, separating them from regular application processes for improved stability and control.</li></ol><h3>Benefits</h3><ol><li>Scalability and Resilience: The Twelve-Factor App principles promote horizontal scalability, fault tolerance, and efficient resource utilization, ensuring applications can handle varying workloads and recover from failures.</li><li>DevOps and Collaboration: The methodology fosters collaboration between development and operations teams, enabling streamlined deployment processes, version control, and reproducibility.</li><li>Cloud-Native and Microservices Architecture: The Twelve-Factor App approach aligns well with cloud-native and microservices architectures, facilitating containerization, orchestration, and scalability in distributed systems.</li><li>Platform Independence: By adhering to the Twelve-Factor principles, applications can be deployed on various platforms and cloud providers with minimal modifications.</li><li>Continuous Integration and Deployment: The methodology promotes automated testing, continuous integration, and deployment pipelines, enabling rapid and reliable delivery of application updates.</li></ol><p>The Twelve-Factor App methodology provides a comprehensive framework for building modern, scalable, and resilient applications. By following the twelve factors, developers can create cloud-native applications that are flexible, maintainable, and easily deployable across different environments. The principles of codebase management, dependency declaration, environment configuration, backing service utilization, and others contribute to application scalability, reliability, and efficient collaboration between development and operations teams. Embracing the Twelve-Factor App approach enables organizations to meet the demands of the digital age and deliver high-quality applications in a fast and efficient manner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74d6a214c9f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software development Mistakes or How Developers Benefit from Best Practices]]></title>
            <link>https://medium.com/@hanokhaloni/software-development-mistakes-or-how-developers-benefit-from-best-practices-7b11f4e40269?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b11f4e40269</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[mistakes-to-avoid]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 18:40:24 GMT</pubDate>
            <atom:updated>2023-07-09T17:46:29.530Z</atom:updated>
            <content:encoded><![CDATA[<p>As a developer (or human) — No matter how careful you are, you will <strong>make mistakes. </strong>It’s not uncommon to encounter the occasional hiccup or oversight during the software development process. However, rather than being discouraged by these mistakes, it’s essential to embrace them as opportunities for growth and improvement. By implementing a combination of best practices and utilizing various tools and techniques, developers can minimize errors, enhance code quality, and rectify any missteps swiftly. In this blog post, we will explore several key strategies that developers can employ to mitigate mistakes and foster a more efficient and effective development workflow.</p><h4>Coding Conventions: Navigating the Path to Clean Code</h4><p>Coding conventions serve as a set of guidelines that establish a uniform style for writing code within a project. Adhering to consistent coding conventions not only improves code readability but also helps prevent common mistakes. By following established conventions, developers can avoid pitfalls and create code that is more maintainable, easier to understand, and less prone to errors.</p><h4>Code Reviews: The Power of Collaboration and Insight</h4><p>Code reviews are a crucial aspect of the development process, where team members assess each other’s code for quality, correctness, and adherence to best practices. By having multiple sets of eyes scrutinize the code, potential mistakes and oversights can be identified and rectified before they manifest as larger issues. Code reviews promote collaboration, knowledge sharing, and continuous improvement, ensuring that software is robust and error-free.</p><h4>Static Code Analysis: Uncovering Hidden Mistakes</h4><p>Static code analysis tools play a vital role in detecting potential mistakes and vulnerabilities within codebases. These tools automatically analyze the source code and identify issues such as syntax errors, unused variables, or potential security vulnerabilities. By integrating static code analysis into the development workflow, developers can catch and address potential mistakes early on, reducing the likelihood of bugs slipping through the cracks.</p><h4>Source Code Control: Safeguarding Against Mishaps</h4><p>Source code control systems, such as Git, provide developers with the ability to track changes, collaborate effectively, and most importantly, recover from mistakes. Through version control, developers can revert to previous working states, isolate and fix issues caused by mistakes, and maintain a comprehensive history of code changes. Source code control empowers developers to experiment, make changes with confidence, and quickly recover from any mishaps.</p><h4>Automated Testing: Building Resilient and Reliable Code</h4><p>Automated testing is an indispensable practice for preventing mistakes and ensuring the quality of software. By writing tests that automatically validate the behavior of code components, developers can catch errors and regressions early in the development cycle. Comprehensive test suites not only provide a safety net against mistakes but also enable teams to refactor and enhance code with confidence, knowing that the tests will detect any issues.</p><h4>Continuous Integration: Early Warning Signs</h4><p>Continuous Integration (CI) is a development practice that involves automatically integrating code changes into a shared repository, followed by running automated tests and checks. CI systems help detect mistakes early on by providing immediate feedback on the build and test status. By integrating CI into the development process, developers can identify and rectify issues quickly, ensuring that the codebase remains stable and functional.</p><h4>Continuous Deployment: Swift Remediation for Mistakes</h4><p>Continuous Deployment (CD) builds upon the CI process by automating the release and deployment of software changes. CD enables developers to fix mistakes quickly by swiftly deploying patches and updates to the production environment. This rapid feedback loop ensures that any issues discovered in production can be addressed promptly, minimizing downtime and maximizing user satisfaction.</p><h4>Conclusion</h4><p>As developers, it’s essential to embrace the reality that mistakes are an inherent part of the software development journey. Keep in mind:</p><ul><li>Coding conventions help us <strong>avoid </strong>common mistakes</li><li>Code reviews help us <strong>find </strong>mistakes</li><li>Static code analysis tools <strong>detect </strong>potential mistakes</li><li>Source code control helps us <strong>recover </strong>from mistakes</li><li>Automated testing <strong>prevents </strong>mistakes</li><li>Continuous Integration <strong>alerts </strong>us to mistakes early</li><li>Continuous Deployment helps us <strong>fix </strong>mistakes quickly</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b11f4e40269" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficient File Uploads and Real-time Communication Protocols]]></title>
            <link>https://medium.com/@hanokhaloni/efficient-file-uploads-and-real-time-communication-protocols-5f1378fd956a?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f1378fd956a</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[files]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 05:12:32 GMT</pubDate>
            <atom:updated>2023-06-21T05:12:32.041Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern systems often require efficient file uploads and real-time communication capabilities. In this blog post, we will explore strategies for improving file upload efficiency using signed URLs and discuss various real-time communication protocols. By implementing these techniques, developers can enhance system functionality and provide a seamless user experience.</p><h3>Efficient File Uploads</h3><ol><li>Chunked Uploads: Divide large files into smaller chunks for efficient transfer, improved reliability, and the ability to resume interrupted uploads.</li><li>Signed URLs: Generate unique, time-limited URLs with specific permissions that allow clients to directly upload files to storage services, reducing server load and improving security.</li><li>Resumable Uploads: Enable users to resume interrupted file uploads without starting from the beginning, enhancing user experience and reducing bandwidth consumption.</li><li>Client-side Compression: Compress files on the client-side before uploading to reduce transfer time and bandwidth usage.</li><li>Parallel Uploads: Allow simultaneous uploads of multiple file chunks to speed up the upload process, leveraging the user’s available bandwidth.</li></ol><h3>Real-time Communication Protocols</h3><ol><li>RTMP (Real-Time Messaging Protocol): A streaming protocol used for delivering live video and audio content over the internet, commonly used in video streaming platforms.</li><li>WebRTC (Web Real-Time Communication): A peer-to-peer communication protocol that enables real-time audio, video, and data transmission directly between browsers or mobile devices without the need for plugins or additional software.</li><li>WebSocket: A bi-directional communication protocol that provides full-duplex communication between clients and servers, facilitating real-time data streaming and enabling server push notifications.</li><li>SSE (Server-Sent Events): A unidirectional communication protocol that allows servers to send events or updates to clients over a single HTTP connection, enabling real-time updates without the need for constant polling.</li><li>HTTP Short Polling: Traditional request-response mechanism where the client repeatedly sends requests to the server to check for updates, suitable for scenarios with lower real-time communication requirements.</li><li>HTTP Long Polling: A technique where the server keeps the client connection open until new data is available, reducing the frequency of requests and enabling near real-time communication.</li><li>Webhooks: User-defined HTTP callbacks triggered by specific events, allowing real-time notifications and triggering actions in external systems.</li></ol><h3>Conclusion</h3><p>Efficient file uploads and real-time communication are crucial features for many modern systems. By implementing strategies such as chunked uploads, signed URLs, resumable uploads, client-side compression, and parallel uploads, developers can optimize file upload efficiency and enhance the user experience. Additionally, considering real-time communication protocols like RTMP, WebRTC, WebSocket, SSE, HTTP short polling, HTTP long polling, and webhooks enables developers to provide real-time updates, streaming capabilities, and interactive experiences. By incorporating these techniques, developers can create systems that meet the demands of today’s dynamic and collaborative applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f1378fd956a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Components and Best Practices for Effective System Design]]></title>
            <link>https://medium.com/@hanokhaloni/common-components-and-best-practices-for-effective-system-design-fd44f051d194?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd44f051d194</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Sat, 17 Jun 2023 18:30:58 GMT</pubDate>
            <atom:updated>2023-06-17T18:30:58.347Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a comprehensive and reliable system requires considering various common components and adhering to best practices. In this blog post, we will explore some commonly used components in system design and discuss essential best practices that contribute to the success of a system.</p><h3>Common Components in System Design</h3><ol><li>Payment Services: Integration with payment gateways and services to enable secure and seamless payment processing, such as credit card payments, digital wallets, or cryptocurrency transactions.</li><li>Analytic Services: Incorporating analytics tools and services to gather insights, track user behavior, monitor system performance, and make data-driven decisions.</li><li>Notification Services: Implementing systems to send notifications via email, SMS, push notifications, or other channels to keep users informed about important events or updates.</li><li>Search and Indexing Services: Leveraging search and indexing technologies to enable efficient searching, filtering, and retrieving of data from large datasets.</li><li>Authentication and Authorization: Implementing secure authentication mechanisms (e.g., OAuth, JWT) to ensure only authorized users can access system resources.</li><li>Logging and Monitoring: Setting up logging and monitoring systems to track system activities, detect errors, and gather performance metrics for troubleshooting and optimization.</li><li>Caching Services: Utilizing caching mechanisms (e.g., Redis, Memcached) to store frequently accessed data and reduce response times, relieving the load on backend systems.</li><li>Queuing Systems: Implementing message queues (e.g., RabbitMQ, Apache Kafka) to enable asynchronous processing, decouple system components, and improve scalability and fault tolerance.</li><li>Content Management Systems (CMS): Integrating CMS platforms to manage and organize content, allowing users to create, edit, and publish content easily.</li><li>Testing and Deployment Automation: Establishing automated testing and deployment pipelines to ensure system reliability, maintainability, and continuous integration and deployment.</li></ol><h3>Best Practices in System Design</h3><ol><li>Design for Scalability: Build systems that can handle increased load by utilizing horizontal or vertical scaling techniques and leveraging cloud computing resources.</li><li>Keep it Simple: Follow the KISS (Keep It Simple, Stupid) principle to reduce complexity and improve system maintainability.</li><li>Use Proper Error Handling: Implement robust error handling mechanisms to handle exceptions, log errors, and provide meaningful error messages to users.</li><li>Employ Security Measures: Incorporate security practices such as input validation, user authentication, data encryption, and protection against common vulnerabilities (e.g., XSS, SQL injection).</li><li>Embrace Automation: Automate repetitive tasks, including testing, deployment, and infrastructure provisioning, to improve efficiency and reduce human error.</li><li>Follow Coding Standards and Documentation: Adhere to coding standards, write clean and well-documented code, and maintain comprehensive documentation for better collaboration and maintainability.</li><li>Plan for Disaster Recovery: Develop backup and disaster recovery strategies to ensure data resilience and minimize downtime in case of system failures or disasters.</li><li>Regularly Update and Patch: Keep system components, libraries, and dependencies up to date to address security vulnerabilities and benefit from new features and performance improvements.</li></ol><h3>Conclusion</h3><p>In system design, considering common components such as payment services, analytic services, notification services, search and indexing services, authentication and authorization mechanisms, logging and monitoring systems, caching services, queuing systems, content management systems, and testing and deployment automation is essential. Furthermore, following best practices like designing for scalability, simplicity, proper error handling, security measures, automation, coding standards, documentation, disaster recovery planning, and regular updates contributes to the success and reliability of a system. By incorporating these components and best practices, developers can create robust, scalable, and maintainable systems that meet the needs of users and businesses alike.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd44f051d194" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Principles and Key Components of System Design]]></title>
            <link>https://medium.com/@hanokhaloni/principles-and-key-components-of-system-design-b66943d5c061?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b66943d5c061</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 18:47:32 GMT</pubDate>
            <atom:updated>2023-06-21T05:14:00.609Z</atom:updated>
            <content:encoded><![CDATA[<p>Developing a robust, scalable, and efficient system can be a daunting task. However, understanding the fundamental principles and key components can make the process more manageable. In this blog post, we will explore the essential principles of system design and delve into key components that are crucial for building scalable and reliable systems.</p><h3>Principles of System Design</h3><ol><li>Modularization: Divide the system into smaller, manageable modules to reduce complexity, improve maintainability, and increase reusability.</li><li>Abstraction: Hide implementation details and focus on essential features to simplify complex systems and promote modularity.</li><li>Layering: Organize the system into layers, each providing specific functionalities, to separate concerns and enhance maintainability.</li><li>Scalability: Design systems to handle increased load by adding more resources (horizontal scaling) or optimizing system capacity (vertical scaling).</li><li>Performance: Optimize system response time, throughput, and resource utilization for efficient design.</li><li>Security: Implement proper security measures and practices to ensure system confidentiality, integrity, and availability.</li><li>Fault Tolerance and Resilience: Design systems to withstand failures and recover gracefully from errors, ensuring reliability and availability.</li></ol><h3>Key Components of System Design</h3><ol><li>DNS (Domain Name System): A hierarchical and decentralized naming system that translates domain names into IP addresses, enabling efficient access to websites and services.</li><li>Load Balancing: Distribute network traffic across multiple servers to improve availability, reliability, and performance using algorithms like Round Robin, Least Connections, and IP Hash.</li><li>API Gateway: Act as an intermediary between clients and microservices, managing and routing requests, enforcing security policies, and providing additional features like caching and monitoring.</li><li>Content Delivery Network (CDN): A network of servers distributed across multiple locations that cache content closer to end-users, improving performance and reducing load on origin servers.</li><li>Message Queue: Facilitate communication between distributed system components by temporarily storing messages in a queue, enabling asynchronous processing and improving scalability and fault tolerance.</li><li>Communication Protocols: Use protocols like HTTP/HTTPS, WebSocket, and gRPC for efficient and secure communication with latency, security, and data transmission requirements.</li><li>Cache: Employ caching mechanisms such as in-memory caching, distributed caching, and browser caching to reduce latency, server load, and bandwidth consumption.</li><li>Database: Choose appropriate databases like relational databases (e.g., MySQL, PostgreSQL), NoSQL databases (e.g., MongoDB, Cassandra), or NewSQL databases (e.g., CockroachDB, Google Spanner) based on data structure, scalability, consistency, and latency requirements.</li><li>Replication Techniques: Maintain multiple copies of data across different nodes for increased reliability, availability, and fault tolerance using synchronous, asynchronous, or semi-synchronous replication.</li><li>Distributed Unique ID Generation: Implement mechanisms for generating unique identifiers in distributed systems to ensure data consistency and integrity.</li></ol><h3>Conclusion</h3><p>Understanding the principles and key components of system design is essential for building scalable, efficient, and reliable systems. By modularizing the system, abstracting implementation details, focusing on layering, ensuring scalability, optimizing performance, implementing security measures, and designing for fault tolerance, developers can create robust systems. Additionally, incorporating key components like DNS, load balancing, API Gateway, CDN, message queues, communication protocols, caching, databases, replication techniques, and distributed unique ID generation enhances the system’s capabilities. By following these principles and utilizing key components, developers can design and implement systems that meet the demands of modern applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b66943d5c061" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My code review checklist]]></title>
            <link>https://medium.com/@hanokhaloni/my-code-review-checklist-138a834fabda?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/138a834fabda</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[checklist]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Fri, 04 Mar 2022 12:18:15 GMT</pubDate>
            <atom:updated>2022-03-04T12:18:15.191Z</atom:updated>
            <content:encoded><![CDATA[<p>It appears, during the year, I have written to myself a couple of points and markers for a code review. These are the main notes I keep in front of me every time I do a review. (funny thing is that only when I am tired, I get to go through every item in the list…)</p><h3>Start cleaning up the code</h3><p>These are the basic things I tend to look at, as a general first sweep of the code.</p><ul><li>Avoid unnecessary comparisons (e.g. if (isOk == true))</li><li>Avoid negations (e.g. variable not<strong>Valid</strong>Item or method called isItem<strong>False</strong>)</li><li>Return boolean expressions directly</li><li>Simplify boolean expressions (but either simplifying the expression or by extracting methods)</li><li>Avoid NullPointerException in conditionals</li><li>Avoid switch fallthrough or missing a switch default case</li><li>Always use bracers (even for one line IF statements)</li><li>Always do null checks</li></ul><h3>Code style</h3><p>Also a part of first sweep — these are painful points that “cramp my style”. Follow these rules to make your code look closer to what you are used too looking at.</p><ul><li>Replace magic numbers with constants</li><li>Favor enums over integer constants and string constants</li><li>Favor for-each over for loops</li><li>Avoid compute-intense operations during iteration</li><li>Group with newlines</li><li>Favor format over concatenation or plus (+) operator</li><li>Favor API over DIY — don’t reinvent the wheel.</li><li>Minimize the function parameters (3 or less)</li><li>Avoid long methods</li><li>Avoid train racks / call chains (e.g. this.getCopoenent().getDefaultView().validate() )</li><li>Avoid absolute paths (e.g. c:\root\admin or ~\documents\project)</li></ul><h3>Comments</h3><p>As a general rule comments tend to be not updated, so I try to keep comments to a minimum. Here’s a couple of point to help with minimizing comments:</p><ul><li>Remove commented-out code (if you want to remember deleted code, let GIT do it for you).</li><li>Replace comments with constants or with utility methods</li><li>Document implementation decision using ADR or comments in classes</li><li>Document using tests &gt; Document using examples</li></ul><h3>Naming</h3><ul><li>Use language naming convention (I personally prefer the default setting of any IDE, linter or style checker out there).</li><li>Avoid single letter names</li><li>Avoid abbreviations</li><li>Avoid meaningless terms</li><li>Use domain terminology</li></ul><h3>Error handling</h3><ul><li>Fail fast — the first thing a public API does is failing if any validation fails (or if any assumption fails).</li><li>Always catch most specific exception first. Avoid catching the most generic exception a language can offer (e.g. throwable in java).</li><li>Always explain cause message / don’t log and throw without adding your cause message.</li><li>Avoid breaking the cause chain / don’t throw new exception and ignore the stack trace of the caught exception.</li><li>Always check before cast</li><li>Always close resources</li><li>Explain empty catch</li></ul><h3>Asserts and tests</h3><ul><li>Logs exist and are thorough</li><li>Logs at appropriate log level (don’t spam errors, info level is not debug, warnings are aimed at a user, don’t swap warning for errors, not every error is fatal)</li><li>Structure tests into Given-When-Then clause</li><li>Use meaningful assertions</li><li>Expected before actual value</li><li>Minimize assertions per test</li><li>Let the test framework handle exceptions</li><li>Describe your tests</li><li>Favor standalone tests</li><li>Parametrize your tests</li><li>Cover edge cases</li></ul><h3>Data flow</h3><ul><li>Favor lambdas over anonymous classes</li><li>Favor method reference over lambdas</li><li>Avoid side effects</li><li>Use collect for terminating complex streams</li><li>Avoid exceptions in streams</li><li>Favor optional over null</li><li>Avoid optional fields or parameters</li></ul><h3>Advanced</h3><ul><li>Remove unnecessary complexity should be avoided. (Keep it simple).</li><li>Avoid code duplication (Don’t repeat yourself).</li><li>No code can be replaced with library functions (Don’t reinvent the wheel).</li><li>Delete dead code.</li><li>Define variables close to where used</li><li>Use the correct access modifiers for methods and properties</li></ul><p>What’s your checklist? Do you use any checklist like this one? Do you have any other points?</p><p>Tell me what you think</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=138a834fabda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yet another list of assets for a game jam]]></title>
            <link>https://medium.com/@hanokhaloni/yet-another-list-of-assets-for-a-game-jam-bef5cfc52c1b?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bef5cfc52c1b</guid>
            <category><![CDATA[global-game-jam]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 09:55:41 GMT</pubDate>
            <atom:updated>2020-01-29T09:55:41.207Z</atom:updated>
            <content:encoded><![CDATA[<p>Being a site admin at BeerSheva <a href="https://globalgamejam.org/">Global Game Jam 20</a>20 (7th year in a row!!!) has brought me to some ritual behavior about the event. Here’s a good list of reources I gathered around the years.</p><p>Royalty Free Graphics</p><ul><li><a href="http://opengameart.org/">OpenGameArt</a> (HUGE Collection of Free Game Assets!)</li><li><a href="http://www.reinerstilesets.de/">Reiner’s Tilesets</a> (Collection of isometric Tilesets)</li><li><a href="http://pousse.rapiere.free.fr/tome/">Tiles Library</a> (Collection of Tilesets)</li><li><a href="http://7soul1.deviantart.com/art/420-Pixel-Art-Icons-for-RPG-129892453">Pixel Art Icons for RPG</a> (420 Icons)</li><li><a href="http://game-icons.net/">Game Icons</a> (+1300 Game Icons)</li><li><a href="http://www.lostgarden.com/2009/03/dancs-miraculously-flexible-game.html">Flexible Game Prototyping Graphics</a> (LostGarden)</li><li><a href="http://www.cgtextures.com/">CG Textures</a> (Texture Library)</li><li><a href="http://www.mayang.com/textures/">Mayang’s Free Textures</a> (Texture Library)</li><li><a href="http://www.frogames.net/content-packs.html">FroGames Proto Packs</a> (3D Prototype Packs)</li><li><a href="http://www.blendswap.com/">Blend Swap</a> (Models for Blender)</li><li><a href="http://www.turbosquid.com/">Turbosquid</a> (Marketplace for 3D models)</li><li><a href="http://3docean.net/">3docean</a> (Marketplace for 3D models)</li><li><a href="http://www.impallari.com/">5 High Quality Fonts By Pablo Impallari</a></li><li><a href="http://www.instantshift.com/category/fonts/">Fonts Collections On InstantShift</a></li></ul><p>Fonts</p><ul><li><a href="http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/">40 Excellent Free Fonts For Professional Design</a> (Smashing Magazine)</li><li><a href="http://designreviver.com/freebies/50-awesome-free-fonts-for-professional-design/">50 Awesome Free Fonts For Professional Design</a>(DesignReviver)</li><li><a href="http://designreviver.com/freebies/10-great-font-resources/">10 Great Font Resources</a> (DesignReviver)</li><li><a href="http://www.smashingmagazine.com/2010/08/12/30-new-free-high-quality-fonts-typography/">30 New Free High Quality Fonts</a> (Smashing Magazine)</li></ul><p>Royalty Free Music (Free Sites — Download for free)</p><ul><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.newgrounds.com%2Faudio%2F&amp;t=M2E4MjU3ZDNmNjQ1MjYzZWFhMTBkOWFjY2QyZjdjMWViOWZkMDY5ZixUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">Newgrounds</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fincompetech.com%2F&amp;t=YWZmMjZjNGYzOGFjMTAyNjU3MmI2MjY1ODExYWEzZGQ3NzVhZTNjYyxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">Incompetech</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fsampleswap.org%2F&amp;t=NDkxNTE1NTVkYzFkZjUxNDNkYzgzOWViNGEzNjBhZjM2OTk2NTY0YyxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">SampleSwap</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.jewelbeat.com%2Ffree%2F&amp;t=ZWMyY2RjMWM0MGE0ZmEwYmRmNmQ1ZDVjOTZlOWVlNjI3NTZiZWQ2YixUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">JewelBeat</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fdig.ccmixter.org%2F&amp;t=YTk0MmIxZjg1OTA4YmI0OWVhMzk2ZjVkMjU5NDg2ZmRkNGFlOTcxMSxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">ccMixter</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.nosoapradio.us%2F&amp;t=Zjg4ZGUzM2IxNWY5NTU1ZTcyODlhYTExOGRiODlmN2FkMDI1NThlZCxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">NoSoapRadio</a></li></ul><p>Royalty Free Sounds (Free Sites — Download for free)</p><ul><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.freesound.org%2F&amp;t=MDI5NGRkOTYxZjUwMzVkOGJjMGQyNmIyYmRmMWI0Y2Y1OTlmMTdkNixUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">Freesound</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.freesfx.co.uk%2F&amp;t=YmU5ZTc5ZGQ1MjMzMmE3MmIxMWM5NjAyODcyODBjNmZjM2I5N2Q2MCxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">FreeSFX</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.stephanschutze.com%2Fsound-library.html&amp;t=OTY4ODM4NzRjNTI3MWVjNmU1MTAxMWMwNjY2OWFjYWRkZTIyNzVmNixUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">Sound Librarian</a></li><li><a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fwww.epicsound.com%2Fsfx%2Findex.php&amp;t=ZTQ3OGU0NzJhODRhZWE5NGQyOTA0MGMyNGQ0Njc1MzQ2ODkzMzljYyxUbU4zdWpESg%3D%3D&amp;p=&amp;m=0">The Guide To Sound Effects</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bef5cfc52c1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trunk based development — version control]]></title>
            <link>https://medium.com/@hanokhaloni/trunk-based-development-version-control-56d7a24db353?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/56d7a24db353</guid>
            <category><![CDATA[agile-development]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Sun, 23 Dec 2018 11:03:35 GMT</pubDate>
            <atom:updated>2018-12-23T11:19:58.716Z</atom:updated>
            <content:encoded><![CDATA[<h3>Trunk based development — version control</h3><p>Managing software projects is still an art. Even when you take a simple slice of the software project, like tracking your history, there are many ways to do it — each with it’s own pros and cons. Have you ever asked yourself how to manage a software project? Would you manage a team of 5 the same as you manage a group of 50? or a single person? How would team size affect your decisions? Is it your decision at all?</p><p>In today’s “agile” development world we consider:</p><ul><li>Working software is the primary measure of progress.</li><li>Simplicity — the art of maximizing the amount of work <strong>not done.</strong></li><li>When considering team effort -done means deployed (so that user feedback could follow).</li><li>Development keeps at a constant pace (indefinitely).</li></ul><p>In this paper I would like to present a “trunk based” methodology for any VCS. Let’s define a couple of term:</p><ul><li><strong>Trunk</strong> is the main body of development, originating from the start of the project until the present. (In GIT this may be the master branch ora develop branch, in TFS ).</li><li><strong>Branch</strong> is a copy of the code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes work according to plan, they are usually merged back into the trunk.</li><li><strong>Tag</strong> is a point in time on the trunk (or a branch) that you wish to preserve. The two main reasons for preservation would be that either this is a major release of the software, or this is the most stable point of the software. For these reasons we would see tag names to consist of stable, nightly, alpha, beta, RC or RTM.</li></ul><p>A <strong>Trunk based development</strong> is when a single trunk is used to create all the features of the product.</p><p>We would like to keep the trunk clean. In small teams we would like not to support versions (i.e. tag versions so that we do not support them —<strong> the cost of supporting two versions at the same time is way to high for small teams</strong>). We would like it to be easy to merge multiple branches, and we don’t want to complicate stuff (especially we don’t want to introduce complex merging strategies).</p><p>In open source projects, major branches that are not accepted into the trunk by the project stakeholders can become the bases for <em>forks</em> — e.g., totally separate projects that share a common origin with other source code.</p><h4>The method</h4><ol><li>Any developer can pick up a feature, and create a new branch for it.</li><li>Any developer can work independently on the feature.</li><li>Upon completion he could ask for merging it into master — so that we can enforce code review at this point OR we could add a continuos integration or testing quality gate).</li><li>When we want to release a version, we create a tag for it. Mostly done by a team leader.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*Wua2SvrbGxEtG9DYyVi_jg.png" /></figure><h4>Limitations</h4><p>for short-lived feature branches are:</p><ol><li>Intermediate merges to master (trunk) <strong>are not allowed</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*39VPxyePYCgRtlROHTkQoA.png" /></figure><p>2. merges (intermediate or not) to other people’s short-lived feature branches <strong>are not allowed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*UGReOp9vg-MVbjbzFtbz1w.png" /></figure><p>3. merges (intermediate or not) to any release branches (if you have them) <strong>are not allowed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*LPSYJ8GlXL7Fsq1886YL1w.png" /></figure><p>4. variations of #2 that are direct from/to the developers clone on their workstation <strong>are not allowed.</strong></p><h4>PROS</h4><ul><li>When coupled with “branch by feature” — works great when you want to progress fast with a small team, and it keeps the trunk clean.</li><li>Clear responsibilities — deliverables are discussed on tags, while history is written in trunk, and “the mess” is kept in a branches. Trunk can be covered by continous integration,and tags could be covered by continous deployment mechanism.</li><li>when team members are co-located, the trunk helps us to get faster feedback.</li><li>feedback is faster in a single trunk, the team can sync more frequently. trunk changes can happen frequently and faster.</li><li>Works best for distributed environment when using feature branching strategy.</li></ul><h4>CONS</h4><ul><li>Assumes that the features (or branches) are independant and branches merge relatively quickly to the trunk.</li><li>May be too fluid for large teams.</li><li>For smaller code base, the cost of creating branches etc can high. Obsolete/dead branches must be deleted regularly.</li><li>You can either do a direct to trunk commit/push or a Pull-Request workflow — but only as long as feature branches are short-lived and the product of a single person.</li></ul><p>Links:</p><p><a href="https://trunkbaseddevelopment.com/">Trunk Based Development</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56d7a24db353" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Learned to Stop Worrying and Love the Logs]]></title>
            <link>https://medium.com/@hanokhaloni/how-i-learned-to-stop-worrying-and-love-the-logs-41d3310e555b?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/41d3310e555b</guid>
            <category><![CDATA[system-logs]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[logs]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Sat, 29 Sep 2018 10:58:23 GMT</pubDate>
            <atom:updated>2023-07-17T13:40:17.865Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a short article that covers the basics of logging and provides a nice introduction and a set of guidelines for better logging your application.</p><h3>Why should I log?</h3><p>To new developers I always say -”Your program is going to die anyway, the least it can do is tell you who killed it”. Developers seem to over-trust the code, have overconfidence in their skill, and their skill is mostly limited to debugging. What to do when you can’t debug — either because of environment constrains (can’t debug in production), or because the bug is not reproducible? This means that the only way to query behavior of your program is the logger.</p><p>As you will see — a second trait of logging is that you can create them in such a way that you can query them for information. Counts, flows of unique-ids can all be seen this way.</p><h3>What to log?</h3><p><strong>Log all the things</strong> — And I mean everything! every little bit of information you can get your hand on should be logged. This is your only audit trail.</p><p>Look at your program as a set of actions/events that occur. The user clicks the button, this raises the onClick event, which calls to a <em>login() function</em> (which you can look at as another event) which calles to the getUser(username, password) function (which is also an event) and so on.</p><p>Just remember that you want logs to be:</p><ul><li>Auditable — all activities that affect user state or balances are formally tracked.</li><li>Traceable — it’s possible to determine where an activity occurs in all tiers of the application.</li><li>High integrity — logs cannot be overwritten or tampered-with by local or remote users.</li></ul><h3>How to write logs?</h3><p>Each event can be characterized using the five W’s:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*awptuLWZoNrDPj-lcMR2Pw.jpeg" /><figcaption>The log entry ingridients</figcaption></figure><p><strong>When </strong>did the event occur? Don’t forget to use a log date and time in an international format so that you can track events from various servers around the globe. I would also recommend you track to the millisecond (although there are some realtime use cases where tracking to the nanosecond might be more appropriate). Another part of “when” is the multithreading/multiprocessing. As multiple things might occur at the same time I would recommend you add the process id and thread id to the log entry so that you could have the option to filter logs by process or thread.</p><p><strong>Where </strong>did the event occur? What’s the application being used (don’t forget to include the name and the version here). What is the location in the code (what class name? what script name? what line number?). A geolocation is also a good idea when you are doing mobile device development or IoT. It’s also a good idea to give the form name, page name or window name for additional “where” context.</p><p><strong>Who </strong>created the event? Was it a user? What’s the source address? Can we identify who did the action? If yes we can write a username, otherwise we can add a session context.</p><p><strong>What </strong>is it all about? What type of event? What’s the severity of the event? Is it just a debug symbol? or a fatal error? (we’ll discuss severity in a second). Is it a security issue? Can we provide any general data about the log? Here’s a list of “what”cases most commonly used:</p><ul><li>Input validation failures</li><li>Output validation failures</li><li>Authentication successes and failures</li><li>Authorization (access control) failures</li><li>Session management failures</li><li>Application errors and system events</li><li>Application and related systems start-ups and shut-downs, and logging initialization (starting, stopping or pausing)</li><li>Use of higher-risk functionality</li><li>Sequencing failure</li><li>Excessive use</li><li>Data changes</li><li>Fraud and other criminal activities</li><li>Suspicious, unacceptable or unexpected behavior</li><li>Modifications to configuration</li><li>Application code file and/or memory changes</li></ul><p><strong>Why</strong> is mostly about given user interaction or event origin. If the event origin is a user action you can express that in the entry point e.g. getUserData or addAccountEntry. For automated parts or where the origin is the system (like a timed event) you can just supply the flow marker for the timed event e.g. reportTimerIntervalExpired.</p><h4>Priorities</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HV_Ad0L3L7yQI1_7bNiaUg.jpeg" /></figure><p>Although log levels come in various flavors, they show various degrees of detail about your application. Here are the most common levels you will need:</p><ul><li><strong>Fatal</strong> Severe errors that cause premature termination.</li><li><strong>Error</strong> Other runtime errors or unexpected conditions.</li><li><strong>Warn </strong>are undesirable or unexpected, but not necessarily “wrong”.</li><li><strong>Info </strong>Interesting runtime events (startup/shutdown).</li><li><strong>Debug </strong>detailed information on the flow through the system.</li><li><strong>Trace </strong>more detailed information. Maybe even variable values, loop counters and low level detail.</li></ul><p>What’s the default log level for your system in production? I believe it should be set to <strong>Warn</strong> level, as info data is mostly not relevant for the natural system behavior.</p><h3>How to read logs?</h3><h4>Logging tools</h4><p>There are many logging tools out there, but they are basically split into 3 parts:</p><ol><li>Text editors that allow you to open large files</li><li>Log aggregators that allows more complex queries/filtering of logs</li><li>Large scale logs management : logs.io, <a href="https://www.elastic.co/solutions/logging">elastic stack</a>, <a href="https://www.loggly.com/elk-stack-alternative/">loggly</a>, etc…</li></ol><h4>Log examples</h4><p>You’ll meet again with you beloved data! Why not use logs to measure metrics? What about using access logs for security analytics? Here are some examples of how to put to use the log managers:</p><ul><li>You can count exceptions — a system is far more robust if the count of unhandled exceptions is low. Just count the work “exception” in your log and put it on a dashboard.</li><li>You can count errors per day. Errors can be an indication for bugs, or for security occurrence in your application.</li><li>You can count transactions per day. High number of transactions per day is of interest to various stakeholders in your organization, and it might provide useful trend information- as well as pose a basis for A/B testing.</li><li>Count user interactions to know how many users accessed the site, logged it, requested a service, and agreed to use the service, to pose some indication of site usability.</li><li>Add log entry if you have a bug and can’t pinpoint it i.e. use the logger to debug you data. Use your ALM marker in the log, and then count this ALM marker — this will give you indication about how many times this error occurs, and if it has been fixed or not.</li></ul><h3>Conclusion</h3><p><strong>There’s no silver bullet</strong>, but the two important factors are to <strong>log all the things</strong>, but then again —<strong> work smarter, not harder. </strong>Just make sure you write it all, and then use some sort of log manager to read it and to continuously adjust as you look in the logs for what to count.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41d3310e555b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things we learned about Cassandra]]></title>
            <link>https://medium.com/@hanokhaloni/things-we-learned-about-cassandra-1f8d1886445f?source=rss-d52a6797efc3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f8d1886445f</guid>
            <category><![CDATA[cassandra]]></category>
            <dc:creator><![CDATA[Hanokh Aloni]]></dc:creator>
            <pubDate>Sat, 25 Aug 2018 07:58:30 GMT</pubDate>
            <atom:updated>2022-09-28T08:25:35.414Z</atom:updated>
            <content:encoded><![CDATA[<p>We’ve been using <a href="https://www.datastax.com/dev/blog/cassandra-2-2">Cassandra 2.2</a> for two systems. The first system is a high performance message dispatching system which handles around thousands of registered clients, at a peak rate of 50 messages per unit per second — for about 2000 units. The second system is an events-aggregating system which also periodically does some processing on inbound data(like<a href="https://en.wikipedia.org/wiki/K-means_clustering"> k-means clustering</a>). It should get around thousands of events per minute, and the processing is done periodically for all events that arrived during that period.</p><h4>Why did we choose Cassandra?</h4><p>We needed to handle large amounts of data across many commodity servers. We found Cassandra to be a <strong>distributed</strong> system to provide <strong>fault-tolerance</strong> and high availability. Cassandra has <strong>no single point of failure</strong>. Cassandra also scales horizontally providing more <strong>scalability </strong>for data load.</p><p>We also found the datastax solution to be complete, and it allows for on-premise solution (as opposed to one hosted on AWS for example). It has <strong>Tunable consistency</strong> which allows you to configure if writes never fails, or if you block so that all data is consistent across all nodes, or a qourum level in between.</p><p>Here are some Dos and Dont’s we learned along the way of taking cassandra into on-prem production solution.</p><h4>Do follow Recommended production settings</h4><p>We do have dedicated machines for Cassandra instances, but we did not follow <a href="https://docs.datastax.com/en/dse/5.1/dse-dev/datastax_enterprise/config/configRecommendedSettings.html">these</a> settings at the beginning. When we started following the recommended production setting in production environment resolved some issues we encountered when stressing the system out (high heap memory usage, as well as a <a href="https://docs.datastax.com/en/dse-trblshoot/doc/troubleshooting/zoneReclaimMode.html">peculiar Linux kernel performance problem on NUMA systems</a>) we saw an increased system throughput of about 20%–30%.</p><h4>Do repair your nodes regularly</h4><p>Our systems delete and update data. It seems that theses operations cause a tombstone based sync mechanism to work. If you want all your nodes to know about the change (i.e. if you want all your data to be consistent) then you must <a href="https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsRepairNodesTOC.html">repair your nodes</a> regularly so that all tombstones are “flushed”, and all nodes are updated. Note that <em>nodetool repair </em>is typically recommended every <em>GC_GRACE_SECONDS</em> (10 days by default). Makes you really think that <a href="http://Cassandra’s “Repair” Should Be Called “Required Maintenance”">Cassandra’s “Repair” Should Be Called “Required Maintenance”</a>.</p><h4>Do keep your server clocks in sync</h4><p>Cassandra uses a concept called ‘Last Write Wins’. So the chronological story your nodes tell you is not the chronological story your clients tell you. Clients out of sync may result in a behavior like this:</p><ol><li><em>Client A writes data</em></li><li><em>Client B writes data</em></li><li><em>Get all data — only data from client B exists</em></li></ol><p>Although we have met an article called Why <a href="https://www.datastax.com/dev/blog/why-cassandra-doesnt-need-vector-clocks">Cassandra doesn’t need vector clocks</a> — we found that having NTP for our servers did the job. We followed <a href="https://www.ibm.com/support/knowledgecenter/zh/SS3JSW_5.2.0/com.ibm.help.gdha_configuring.doc/com.ibm.help.gdha_configuring.doc/gdha_configuring_time_sync_cassandra_nodes.html">this guide</a>. We also considered running our own server as proposed in <a href="https://blog.rapid7.com/2014/03/17/synchronizing-clocks-in-a-cassandra-cluster-pt-2-solutions/">this guide</a>.</p><h4>Do monitor your nodes</h4><p>If you want your cluster to be robust, you need it to work with no human interaction — or interact with it when it asks you to. For this you must enter the <a href="https://www.scalyr.com/community/guides/zen-and-the-art-of-system-monitoring">zen of monitoring</a>, raising alerts you learn are indicative, and ignore those that are not. Have an external monitoring system to monitor the following:</p><ol><li>Node state change — nodes should not go down, nodes should not flap between states. ALWAYS investigate flapping nodes, this behavior is indicative of a real problem on that node. We use <a href="https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsStatus.html">nodetool status</a> for this metric.</li><li>read/write latency — latencies going up are a good indication of something going on. See <a href="https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsThreadPoolStats.html">read/write latency statistics</a>.</li><li>sstable count — if your count goes up it means that you overrun compaction. See <a href="https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsTableStatistics.html">Table statistics</a>.</li><li>disk usage — running out of disk space will cause node failure. Aim for less than 80% disk usage if you are not using compaction, aim for the 50% mark if you do (as compaction creates a lot of sstables).</li></ol><h4>Don’t run nodetool compact manually</h4><p>Running manual compaction will cause creation of very large sstables. This bloats your nodes with data which is not used afterwards.</p><h4>Do select the right compaction strategy</h4><p><a href="https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsConfigureCompaction.html">Compaction strategies matter</a> . SizeTieredCompactionStrategy for writes, LeveledCompactionStrategy for reads. DateTieredCompactionStrategy has some problems and needs — it’s an alternative for time series data and will be deprecated.</p><h4>Don’t model your data as if you are using SQL</h4><p>Data modeling in Cassandra uses a query-driven approach, in which specific queries are the key to organizing the data. Schema is the definition of how data in the table is arranged. It’s quite the other way around in SQL — in SQL we <em>normalize </em>the data, in Cassandra we <em>deformalize </em>the data. Before creating a data model in Cassandra — consider the following:</p><ol><li><a href="https://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling">Basic Rules of Cassandra Data Modeling</a> will give you the basics.</li><li>Follow a datamodel guide like <a href="https://wiki.apache.org/cassandra/DataModel">this one</a>.</li><li><a href="https://docs.datastax.com/en/cql/3.3/cql/cql_using/useWhenIndex.html">Indexing the data</a> counters performance issues for specific queries, so understanding indexing is an important step in the data modeling process.</li></ol><h4>Do assume Cassandra will timeout when querying large amount of data</h4><p>When selecting for large amounts of data Cassandra will result in an OperationTimeOut error. Although you can fiddle around with parameters like <em>clientTimeout</em>, <em>commitlog_segment_size_in_db</em> and even <em>max_mutatuin_size_in_kb</em>, we learned that probably your are having a problem where your systems depends on large caches in database. Fiddling with configuration parameters will only postpone the problem. The only way to avoid the problem is to go back to the data and apply new partition keys, or index the data.</p><p>Also make sure that your application will not fail if it gets a timeout from Cassandra.</p><h4>Don’t rely on backup and restore mechanism for production line</h4><p>Backup and restore will introduce downtime. For mission critical systems downtime is unacceptable. We found that creating exports of small static data, and giving the option to “delete the old” gives us a much more robust system. Although used only in crisis — this solution is faster than the recommended <a href="https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_backup_restore_c.html">backup and restore guide</a>. Namely:</p><ol><li>Snapshots require downtime for when restoring from a snapshot.</li><li>Dumping into a new cluster requires stopping the nodes.</li></ol><h4>Conclusion</h4><p>All in all Cassandra is really great for writing large amounts of data, and for querying data. The keyword large should resonate as it introduces new concerns into the system. Be advised, when you use Cassandra you have the ups and downs of a distributed, scalable, tunable, wide column store, monitored and managed system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f8d1886445f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>