<?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 Affan Syed on Medium]]></title>
        <description><![CDATA[Stories by Affan Syed on Medium]]></description>
        <link>https://medium.com/@affan.syed?source=rss-43bac390cfe9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7vUzm6KK6mPswq8K</url>
            <title>Stories by Affan Syed on Medium</title>
            <link>https://medium.com/@affan.syed?source=rss-43bac390cfe9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:24:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@affan.syed/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[When is Thinking of LLMs as Humans Not a Bad Idea?]]></title>
            <link>https://medium.com/emumba/when-is-thinking-of-llms-as-humans-not-a-bad-idea-ecb68f3c155b?source=rss-43bac390cfe9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecb68f3c155b</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[genie]]></category>
            <dc:creator><![CDATA[Affan Syed]]></dc:creator>
            <pubDate>Wed, 14 May 2025 06:48:37 GMT</pubDate>
            <atom:updated>2025-05-14T06:48:37.426Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Technological revolutions occur when foundational shifts fundamentally alter how systems are conceived and built. The invention of the microprocessor was one such pivotal moment, revolutionizing computing by enabling programmable, scalable, and deterministic automation, ultimately laying the groundwork for personal computing, software-driven logic, and modern digital infrastructure. Today, we are witnessing another transformative paradigm shift with the advent of Large Language Model (LLM)-based agents — systems capable of autonomous reasoning, dynamic inference, and adaptation.</p><p>This blog shares the opinion of why the introduction of LLMs as a computing artifact marks the beginning of a new paradigm. First, it clarifies how these systems differ fundamentally from traditional deterministic computing, emphasizing their ability to reason autonomously. Next, it introduces a helpful anthropomorphic analogy, mapping the experience and specialization of LLM-based agents to human expertise, offering practical guidance for their selection and integration. Finally, it then discusses how these evolve into collaborative multi-agent systems, mirroring modular design principles inspired by microservices, and explores how thoughtfully orchestrating these hybrid architectures — balancing autonomous cognition with deterministic logic — will shape the future of computing.</p><h3>LLMs as New Computing Paradigm</h3><p>Throughout history, fundamental changes in computing architecture have sparked technological revolutions. The invention of the microprocessor was precisely such a transformative event — because it profoundly changed how computation can be automated. Microprocessors automated mathematical operations within compact, programmable chips, enabling the creation of <em>structured</em> and <em>deterministic</em> software systems. This innovation was accelerated by advancements in chip design, and parallel growth in software tooling, resulting in a computing stack we have become accustomed to until late 2022.</p><p>LLMs being introduced as a computing artifact marks a similarly transformative moment. Unlike traditional software, which executes explicitly defined instructions, LLMs introduce dynamic reasoning, adaptive planning, and knowledge synthesis directly into software architectures. The emerging LLM-based development stack — consisting of agents, tools, frameworks, and platforms — is poised to unlock an entirely new universe of computing applications. This inflection point is likely similar to the one triggered by the co-evolution of microprocessors and their supporting development ecosystems in late 90s.</p><p>The future of computer system design will, thus, be driven by continued model growth and the effective integration and orchestration of these reasoning abilities within workflows, legacy software applications, and infrastructure. Much as modern computing depends on integrated software, memory, and networking rather than raw computational power alone, the transformative impact of LLM-based agents lies in their ability to become deeply embedded within digital architectures, redefining what it means for you to build a “<em>software application</em>”.</p><h3>Human-Like Attributes of LLMs: Experience and Expertise</h3><p>While the historical analogy of the microprocessor helps us appreciate the scale and impact of this computing shift, understanding its true potential for practical application requires a different framing. To fully grasp the possibilities and limitations of these cognitive systems, it’s useful to think of them not merely as sophisticated software components, but as<em> human-like thinkers</em> — entities characterized by experience, specialization, and collaborative intelligence. This <em>anthropomorphic</em> analogy provides us with intuitive language and practical guidance for selecting, designing, and orchestrating intelligent systems.</p><p><em>Note: This analogy is purely opinion based on my experiences at </em><a href="https://www.linkedin.com/company/emumba/">Emumba</a> overseeing the <em>development of GenAI features and products, but not grounded in any deep scientific rigor.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IIJeX-BG24LUA91QzEuuhA.png" /></figure><p>Thinking of LLMs as Humans!</p><p>The first axis of this analogy relates to experience. Here, we propose that human experience is roughly analogous to parameter size. A model with a larger number of parameters behaves more like a seasoned expert: it brings a broader, more nuanced understanding, often yielding “gray-haired” responses — balanced, context-aware, and mature. Even when trained on the same data, a large LLM tends to produce insights that feel more refined, simply because its architecture allows for deeper abstraction and broader generalization. Parameter size, then, becomes a useful proxy for accumulated experiential depth.</p><p>The second axis focuses on specialization. In human terms, we gain expertise by immersing ourselves in a subject — through study, repetition, and practical application. LLMs exhibit a similar pattern through fine-tuning or task-specific training. A smaller model, with relatively few parameters, may lack the broad contextual intelligence of a large model, but when trained narrowly on a single domain, it can outperform larger models in focused tasks. This gives rise to a design spectrum — from generalist foundation models to small, domain-specific experts. It also explains the growing interest in tuning and distilling Small Language Models (SLMs), which trade generality for efficiency and target performance.</p><p>Taken together, these two axes — experience and specialization — create a conceptual space in which we can classify different types of LLMs. Specialization itself is multidimensional, spanning a wide range of domains and tasks. Foundation models, with high parameter counts and web-scale training data, sit in the upper-right of this space. These models are akin to polymath humans — capable across a range of disciplines. Fine-tuned SLMs, on the other hand, sit in the upper-left: narrow experts trained deeply in one domain. General-purpose LLMs map to seasoned professionals within a field, while small, broad models resemble junior contributors — capable, but needing direction.</p><p>Importantly, this analogy offers a <em>useful design tool.</em> It allows us to reason about which type of LLM to use when architecting solutions. Like choosing a team member for a specific role, selecting the right model involves balancing cost, availability, and complexity. Do we need broad judgment across ambiguous domains? Or a narrow, fast, and efficient expert? Are we optimizing for latency, licensing, or local inference? The human analogy gives us language to make these trade-offs tangible and purposeful in design conversations.</p><p>While standalone LLMs can reason impressively, their lack of memory and inability to retrieve greater context, limits contextual depth and continuity. This is where LLMs-based agents come in — wrapping LLMs with memory, tool integration, and multi-turn interaction logic. This transition mirrors how human intelligence becomes more effective when supported by memory aids, tools, and collaborative infrastructure. The addition of memory transforms a stateless responder into a persistent, evolving participant — enabling the leap from one-shot prompts to system-level cognitive workflows.</p><h3>From Standalone LLMs to Multi-Agent AI Systems</h3><p>As LLM-based agents mature, the next natural evolution is toward multi-agent systems — collections of specialized agents collaborating to solve complex tasks. The same principles of experience and specialization apply at the systems level, where agents with distinct focus areas and levels of expertise are orchestrated into cohesive, goal-driven teams, much like human teams. If a single agent is like a skilled professional, a multi-agent system is a well-structured team — each member contributing its unique capabilities toward a shared objective.</p><p>This mirrors the architectural philosophy of <em>microservices</em>. In well-designed systems, responsibilities are split across independent, domain-focused services that interact through clear contracts. The power of this approach lies not just in scalability, but in modularity, specialization, and the ability to evolve each part independently — principles that map cleanly to multi-agent GenAI design.</p><p>Rather than relying on a monolithic model to handle everything, we decompose intelligence into focused agents — retrievers, planners, synthesizers, validators — each contributing to the overall reasoning process. These systems are not just more scalable, but also more interpretable, because each agent has a well-defined role.</p><p>Frameworks like AutoGen, CrewAI, and Letta are already enabling this shift. They provide the primitives for composing agent workflows, managing context, and defining inter-agent coordination. Much like service orchestrators transformed microservices, these frameworks are transforming how we build AI-native architectures — not by scaling a single model, but by designing intelligent, modular systems of collaboration.</p><p>This shift from monolith to modularity — from solitary reasoning to orchestrated cognition — is more than just scaling. It demands that we move beyond deploying single models and start designing teams of agents, each specialized, each with a different capability level, yet collectively smarter and more capable than any individual component alone.</p><h3>The Future Areas of GenAI System Design</h3><p>Just as the invention of microprocessors eventually led to entirely new ecosystems — operating systems, distributed computing, and cloud platforms — the advent of LLM-based agents will drive the emergence of many interesting new opportunities. While growth in model size and performance remains important, equally compelling opportunities lie in how we integrate autonomous reasoning deeply within software, infrastructure, and intelligent workflows.</p><p>The real shift will occur as LLM-based agents move beyond external tools to become core components embedded directly into digital architectures. Just as human experts rely on supporting tools, structured processes, and collaboration frameworks, AI-native systems will embed cognition directly into workflows, applications, and infrastructure. Cloud platforms will evolve to orchestrate cognitive workloads dynamically, much as they currently distribute computational resources. These platforms will manage AI reasoning tasks at scale, continuously learning and adapting, just as humans do within dynamic teams.</p><p>Future systems will not be purely LLM-based; traditional software components and deterministic systems will persist where predictability is paramount. Designing effective systems thus requires creating hybrid architectures — carefully balancing autonomous cognition from agents with traditional rule-based logic. The analogy to human teams helps here again: just as effective organizations blend expert human judgment with structured processes and management, the next generation of software solutions will need to blend reasoning agents with deterministic guardrails and processes and <em>effective</em> management of these non-deterministic, reasoning, agents,</p><h3>Conclusion</h3><p>We stand at a transformational moment in computing, echoing the fundamental shift driven by the microprocessor. Just as microprocessors allowed us to automate deterministic tasks, LLM-based agents enable us to integrate autonomous reasoning directly into our system designs. Guided by the human-like attributes of experience and specialization, our future systems will be modular — carefully balancing powerful cognitive agents with traditional software components. The opportunity now is to lead — not just by deploying more sophisticated models tools, but by thoughtfully orchestrating intelligent, collaborative systems. Organizations that lean into this new paradigm will help shape not just the next generation of systems, but the future of how we think, work, and build together.</p><h3>#Genai #Genie</h3><p><em>Originally posted on </em><a href="https://www.linkedin.com/pulse/evolution-software-system-design-age-llms-affan-syed-qepuf/"><em>LinkedIn</em></a><em> as well</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecb68f3c155b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/emumba/when-is-thinking-of-llms-as-humans-not-a-bad-idea-ecb68f3c155b">When is Thinking of LLMs as Humans Not a Bad Idea?</a> was originally published in <a href="https://medium.com/emumba">Emumba</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The journey of million(s) devices on AWS: Kafka, Streaming, and Scaling]]></title>
            <link>https://medium.com/emumba/the-journey-of-million-s-devices-on-aws-kafka-streaming-and-scaling-9582d5bd5b74?source=rss-43bac390cfe9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9582d5bd5b74</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[big-data-analytics]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Affan Syed]]></dc:creator>
            <pubDate>Thu, 24 Mar 2022 09:35:03 GMT</pubDate>
            <atom:updated>2022-03-24T11:36:47.483Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cRKmkylb3YEMLLiIvZbC-g.png" /></figure><p>This blog takes the reader through the journey of Emumba scaling a streaming pipeline with IoT data from a few dozen <strong><em>million devices,</em></strong> and the lessons learned.</p><p><em>The intended audience are data-engineers interested in the interplay of streaming and Big Data scale.</em></p><h3>Introduction</h3><p>As we digitize the physical world, we have to grow accustomed to dealing with millions of devices, reporting short, but regular, data to a central “Cloud” <em>(we ignore the edge processing paradigm for now, as it is not relevant to our use case here)</em>. This central <em>Cloud </em>then needs to handle not only the velocity and amount of data, but also apply some semantic meaning to the data for it to be later consumed for business purposes.</p><p><em>Emumba Inc.</em>, a boutique AWS Select Partner with its HQ in the Silicon Valley, was involved in building the PoC for such a solution. This blog intends to share the experience of implementing such a truly Big Data, streaming solution over AWS infrastructure, and the client and use-case are not relevant to the understanding here.</p><h3>Streaming, ingesting, and querying real-time data — at scale!</h3><p>We were asked to review a scenario where a few dozen million devices send a small payload (about 1.2Kb of a JSON) to a central location, <strong>regularly</strong>. The device data was already aggregated (at a scale of ~10K devices) and then sent to a Kafka cluster. <strong><em>Note: this scenario is generic to nearly any real-world IoT application.</em></strong></p><p>The <strong>challenge</strong> was to enable stream processing, ingestion and querying of the data at the scale needed — while proposing an architecture that remains <em>cost-effective</em>.</p><p>The first thing we did was to convert the data processing needs at the target scale. The numbers that we got, shown to a first-order approximation, were those that made us take stock of our architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*T3vB0UrJP1wRAG9H7F3oAA.png" /><figcaption>Understanding the data size for the problem space</figcaption></figure><p>Not only was this a <strong>huge</strong> data size (26 TB is approximately 14.000 HD movies) required to be handled at ingestion and for stream processing, we needed the ability to query this data in near-real time (seconds) for the purpose of analytic dashboards.</p><p>We dabbled with the idea of using Redshift, Snowflake, and a few other modern data-warehouse solutions, coupled with using AWS Kinesis; however, these turned out to either unable to handle the scale, or did so at an exorbitant cost for the target scale that made the business case unviable.</p><p>We finally settled on an architecture that had the following three components:</p><ol><li><a href="https://kafka.apache.org/"><em>Kafka</em></a><em> </em>for ingestion of the data that was partitioned around a composite key resulting in individual time streams</li><li><a href="https://kafka.apache.org/documentation/streams/"><em>KStreams</em></a><em> </em>for stateful stream processing; needed to achieve the business objective</li><li><a href="https://druid.apache.org/"><em>Druid</em></a><em>/</em><a href="https://imply.io/"><em>Imply</em></a> as the real-time querying datastore, where we use Imply’s <a href="https://imply.io/imply-pivot/">Pivot</a> for dashboarding.</li></ol><p>[<em>note: Sizing and tweaking of the druid cluster was an effort of its own, which we will skip to retain focus on the remaining infrastructure</em>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppsrjGecMoRv6_1vCVnylA.png" /><figcaption>A High Level view of the proposed streaming architecture — very vanilla, I know!</figcaption></figure><p>We built this system, deployed it, and tested it as a <strong>PoC</strong> with simulated data for <strong><em>only 100K devices</em></strong>. The PoC setup included a separate Kafka and KStreams cluster using <em>m5.xlarge</em> instances with EBS volumes. We were using the <em>suppress</em> functionality in KStreams API to provide a single packet per reporting interval, and had enabled <a href="http://rocksdb.org/"><em>rocksdb</em></a> as the key-value store to keep the streaming state.</p><p>Since all components are natively scalable (Kafka, KStreams, Druid), we assumed that horizontally scaling the PoC setup would be a simple interpolation. We had instrumented our PoC cluster with monitoring using both <a href="https://www.netdata.cloud/"><em>netdata</em></a><em> </em>and custom JMX scripts to track the consumption and production rate of our cluster, and thus had a good idea of the resource consumption for our PoC with 100K devices.</p><p>Thus, when the client asked us to <em>demonstrate the architecture working at the target scale</em>, we believed this would be a straightforward task. We estimated, using simple interpolation, that an eight (8) node cluster (for both Kafka and KStream) would be sufficient … and so we set up a much larger cluster to handle the case for the ~30x larger scale. Since this was to be a production setup, we also enabled replication on Kafka partitions.</p><p>Lo and behold … the entire architecture collapsed as soon as we tried to feed in data at the rate of ~250k events/sec.</p><h3>What goes unnoticed at PoC — doesn’t stay unnoticed at scale!</h3><p>What comes next is a whirlwind tale (I believe this happened over 2 weeks, but we aged much more) of how we got to the final solution: I will elaborate on each step to identify not only the process, but also <strong>the mistakes</strong> we made scaling a stream processing architecture.</p><p>What went wrong? First, we observed that the consumption rate (required at 250k events/sec) for our stream applications would periodically collapse to zero. We looked at our Kafka and KStream nodes and found the following CPU behavior (apologies for the scratchy pics):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iX0aH1YqQTf4TkLXKd-YPA.png" /><figcaption>Kafka seems to perform well, KStream application however had periodic CPU stalls without any discernable reason. No disk/network bottlenecks either.</figcaption></figure><p>Clearly, the Kafka cluster doesn’t show any bottleneck, but the stream application was periodically idle, without any apparent reason.</p><p>We immediately (<strong>caution</strong>*: without root causing, trying a solution is not fruitful*) tried to scale the streaming cluster both vertically (8, m5.<strong>2xlarge</strong> instances) AND horizontally (13 m5.xlarge instances). However, both attempts yielded similar results (note: while scaling horizontally we also increased the # of Kafka partitions).</p><p>A <strong>first root cause by</strong> looking at the memory usage then indicated we needed to balance the JVM heap size on KStream nodes to handle in-process memory needs but also allow memory for use by <em>rocksdb (written in C++)</em> to store a window’s worth of data. We calculated the memory needed on a KStream node beyond the heap with a rough calculation for the size of data that is stored in memory, per partition, for our 15 minute window size.</p><p>This resolved one problem; however, we next found <strong>a)</strong> disk I/O related stalls and <strong>b)</strong> that the stream application’s consumption rate periodically went to zero when left to run for some time period.</p><p>We then, to handle the disk I/O limitation, decided to go with storage optimized <em>i3 en.xlarge</em> instance (<strong>caution</strong>*: without exact calculation of the I/O needs, selecting an infra resource is not wise)*. We further realized, with monitoring and R&amp;D, that while using the <em>suppress</em> functionality the KStream application was requiring significantly more memory and disk I/O than were needed for our stateful computation. We then went ahead and implemented a custom suppress functionality since at our scale optimization would only help resource crunch and address the second problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*bAfyIvezhMJuwLvanKEe6g.png" /><figcaption>Isn’t there a steadily decreasing consumption rate after around 30 min?</figcaption></figure><p>These two changes improved the performance considerably, however, we still had a blocker. While now the consumption rate would start at a very high rate (350K events/sec) it would <strong>consistently</strong>, <em>after around 30 minutes,</em> decrease to a much lower and unacceptable rate.</p><h3>Disk/Network bottlenecks and rate limiting instances</h3><p>We were frankly confounded by this behavior and decided (side note: <em>as if there was another option</em>) to take a deeper look into the instance metrics.</p><figure><img alt="Something strange happens to disk and network rates after 30 minutes!" src="https://cdn-images-1.medium.com/max/1024/1*FA-R_RDSol1M1XCzrSNJKw.png" /><figcaption>Something strange happens to disk and network rates after 30 minutes!</figcaption></figure><p>This is when we delved into the details around <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage-optimized-instances.html#storage-network-performance">network and I/O limits</a> (<strong><em>mistake</em></strong><em>: not understanding the rate limits on network and disk usage</em>) for AWS instances. We see that most instance types, even with ENA, support a high burst rate for traffic but have a much lower baseline bandwidth. Thus, for our selected <em>i3en.xlarge</em> while the <strong>burst rate</strong> is <strong>25 Gbps</strong>, the <strong>baseline</strong> (consistent) bandwidth is <strong>4.2 Gbps</strong>. The key point <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html">from here</a> is:</p><blockquote><em>To meet additional demand, they can use a network I/O credit mechanism to burst beyond their baseline bandwidth. Instances can use burst bandwidth for a limited time, typically from 5 to 60 minutes, depending on the instance size.</em></blockquote><p>A similar behavior occurs for disk I/O with EBS optimized instances, where maximum throughput is also bursty for certain instance types. The <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html#ebs-optimization-support">key point from here</a> (matches our failure-after-30 min observation) is as follows:</p><blockquote><em>These instance types can support maximum performance for 30 minutes at least once every 24 hours. If you have a workload that requires sustained maximum performance for longer than 30 minutes ….</em></blockquote><p>Our storage optimized <em>i3en.xlarge</em> instance was one of those instances that didn’t support sustained disk IOPs.</p><p>Looking back, the nature of streaming operations defines sustained and consistent high network and disk I/O; thus, it was imperative to choose instance types that provide <em>sustained throughput</em>.</p><h3>Defining the sustained network and disk throughput needed</h3><p>We then took a step back and decided to properly estimate the cluster-wide network and disk throughput needed for our streaming scenario.</p><p>Here understanding the architecture and replication strategy for Kafka and KStream becomes essential.</p><p>In a production deployment, Kafka cluster with a minimal replication factor of 2 (replicating data to different nodes) will result in doubling the network requirements (0.3GBps) and since Kafka writes to disk, a similar increase in disk I/O.</p><p>Then, with KStream applications, resiliency is achieved by pushing state-store data to a <em>changelog</em> topic on the Kafka cluster at each node. Our applications had a per-device state [1.2KB], and that translated to another 0.3GBps requirement to write to Kafka, implying both network and disk I/O.</p><p>Finally, Druid reads from the output topic, thus implying another factor of network and IOPs.</p><p>The above roughly equates to around 3GBps or 24Gbps of sustained network and disk throughput, across the cluster, required to manage this scale.</p><p>We decided, in view of the above requirements and after a few tweaks, to go with <em>i3.8xlarge</em> instances for our Kafka and KStream cluster. This AWS instance has the following performance details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogpq_XuohQrf-zp4Spw6dA.png" /></figure><p>We note that our monitoring showed that both Kafka and KStream had complimentary resource needs. Thus, while the streaming application was CPU intensive, Kafka (due to multiple in/out from Kafka) was disk intensive.</p><p>Thus, we choose to combine the Kafka broker and KStream nodes on this 3 node (initially) cluster.</p><h3>Knowing your Pet VMs, again!</h3><p>We were quite confident that with this setup, now our architecture would support the 250k events/sec processing capability on a sustained basis.</p><p><em>However</em>, when we set up the cluster and observed its performance, it would not perform as per our calculation. We went back to — you guessed it — monitoring the instance and observed that <strong>one</strong> of the nodes on the cluster had very bad disk performance, which was surprising since our streaming data was evenly balanced and similar operations and therefore, similar disk usage is expected on all nodes.</p><p>After a day worth of debugging and trying many different tweaks (the customer demo was due), we finally decided to delete that instance and use a brand new instance in our cluster. <strong>Voila!</strong> adding this fresh instance solved the problem — clearly that one node had a disk performance issue that was causing the flaky performance.</p><p><em>This leads us to such a </em><strong><em>counter-intuitive observation</em></strong>: we move to the cloud so that our VMs are no longer pets, but cattle. However, when such a high performing cluster is needed to support the target streaming use case — your cluster nodes become <em>pets, again</em>!</p><p>While we set up this infra ourselves due to the cost consideration of managed services, such incidents bring home the benefit of using managed services like <em>Kinesis</em> or <em>MSK</em> to enable production-level, Big Data and streaming workloads.</p><p>With the final change, we were able to deploy and demonstrate &gt; 250K events/sec processing capability over a sustained period of time and were ready to roll this into production for our client.</p><h3>What did we learn?</h3><p>This blog is meant to converge certain learnings that the reader can take away. As the reader will observe, we had several hiccups in executing the project, most that we will — using hindsight — not want to repeat. Here, I will summarize these key take-aways for the reader planning to build scalable streaming systems:</p><ol><li><strong>Do extensive back-of-envelope calculations :</strong> When dealing with Data Engineering problems, scaling from a functional PoC is not a simple interpolation of infrastructure resources needed for the PoC. You need to first deeply understand the architecture of underlying <em>distributed</em> systems (Kafka and KStreams in this case), especially their scaling strategies, and the interplay between them at Big Data volume and velocity.</li><li><strong>Understanding disk and network base-throughput:</strong> The base-load for network and disk I/O comes from the computation calculation, and from understanding the underlying distributed system behavior at production load. Typically, on a cloud infrastructure, this calculation implies using high-end instances that support sustained rates. These, in turn, are expensive instances, and hence the choice of correct instances (memory vs compute vs disk intensive) has a massive <em>impact</em> on the final cost of the infrastructure.</li><li><strong>Complementary workloads</strong>: With the above instance constraint for high end resource (i3.8x has 32 CPUs with 244 GB RAM, while a c5d.9x has 36 CPUs with 72 GB RAM), it is important to optimize the placement of workloads that have complementary resource usage. Thus, placing Kafka and KStream on the same node was essentially a resource optimization. When using Kubernetes or EKS, using node affinity for such a purpose would be the appropriate solution.</li><li><strong>Managing pets is no fun, use managed services when possible:</strong> A significant amount of pain in our setup came from managing the underlying infra services (Kafka and KStreams) and their limitations. Using Kinesis and Kinesis Data Analytics would have certainly reduced our headaches. However, when cost constraints — and being cloud-agnostic — is a must, opting for custom solutions comes with operational costs that need to be properly understood. Thus a proper TCO of every solution that includes operational (and <em>cognitive</em>) cost, is important.</li></ol><p>We hope that you enjoyed reading this blog, and have learnt something new from this writeup. Please reach-out at <em>hello@emumba.com </em>if you want to interact with us more on similar problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9582d5bd5b74" width="1" height="1" alt=""><hr><p><a href="https://medium.com/emumba/the-journey-of-million-s-devices-on-aws-kafka-streaming-and-scaling-9582d5bd5b74">The journey of million(s) devices on AWS: Kafka, Streaming, and Scaling</a> was originally published in <a href="https://medium.com/emumba">Emumba</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>