<?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 Basil Skaria on Medium]]></title>
        <description><![CDATA[Stories by Basil Skaria on Medium]]></description>
        <link>https://medium.com/@Zakbasil?source=rss-22dd81aa7aab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gc7Lxb5U5IrPv74iR0ReLQ.jpeg</url>
            <title>Stories by Basil Skaria on Medium</title>
            <link>https://medium.com/@Zakbasil?source=rss-22dd81aa7aab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 01:45:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Zakbasil/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 experience insignia: My tale of Ladakh — Towards Pahalgam]]></title>
            <link>https://medium.com/@Zakbasil/the-experience-insignia-my-tale-of-ladakh-towards-pahalgam-b75a2f358da8?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/b75a2f358da8</guid>
            <category><![CDATA[pahalgam]]></category>
            <category><![CDATA[biketrip]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[ladakh]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 14:58:06 GMT</pubDate>
            <atom:updated>2026-10-21T05:02:06.407Z</atom:updated>
            <content:encoded><![CDATA[<p>This cozy room felt tight after 2 days of winter simulated train journey, and late-night sleep yesterday. Slept like a grizzly on hibernation. Woke up after 6 hours, late for the plan to reach Pahalgam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DiYV3TGKZebwgQluCg1twA.jpeg" /></figure><p>With the rumbling stomach, we started loading our gears and bags were corded to the bikes. Another hour lost. Let me explain. Every long trip, I carry my riding gears, a touring jacket with all the armor to protect me from impact of a fall and a leather enduro boot to protect up to my upper shin.</p><p>I freshened up, and gearing up procedure begins. I wore my liners, then a rugged cargo pant, a quick dry T-Shirt, the jacket, now about to wear the boots. I felt annoyed that I have to remove half the things to put on my riding socks. Though the region was warm and dry, last day there were sudden cloud drop-lings for hours. To have a wet feet in a boot is comparable to walking the swamps all day, not so desirable. So a pair of riding socks help to keep water from seeping in. The order matters like solving layers of a Rubik’s cube, miss one, you almost restart. So I did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00vxVWVFIgn8XEQ0JCUmBQ.jpeg" /><figcaption>My Alpinestar tech 7 Bogota Drystar Enduro boots</figcaption></figure><p>Bags were packed tight, we moved to the ground floor reception, to drop off the keys. We saw daylight by then. As bikers, starting with daylight is like being late to an important meeting, we’d have to face some harshness later. Unlike layoffs, we had to face the sun, annoyance of Indian honky traffic, and bad roads under the heat. We had few bungee cords to setup the bike, my red wildcraft rucksack went first, tightly bound with its independent cords. Then on top goes my new duffle bag, mounted with a flat strip cord. All set!</p><p>Wore my balaclava after ensuring everything is good. Over goes the helmet, then my specs. Three step process to keep the head safe. The order was disrupted. AGAINNNN! I missed my ear plugs, to protect my ears from the not so scary but creepy tinnitus. Removed all the elements, with AAARRRGGGHH noise in my head, and layered up again. The ear plugs are really important to keep wind noise away. The constant noise can disrupt the internal structure of the hair structure in ear system and cause constant ringing noise and eventual loss of auditory reception.</p><p>Alas! We commence after warming the bikes for a minute. Full tank fuel and energy to rock the roads to Pahalgam. Map was set on an auxiliary phone with Sooraj, he led the way to the main highway. The bliss of ever so lightly mist filled roads with cold breeze, sneaking through tiny crevasses, a mellow tone of brightness started the day at ease.</p><p>We have over 500 Kms to travel. We rolled fast through the well-built infrastructure before traffic sets in. A simple, yet consistent pace was picked, exact speed willfully forgotten, since it could be self-indictment. We reached a remote lush green grainfield from city after Jalandhar. That’s about 3 hours from CH. Hesitatingly we took a U-turn towards a building.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kxUGFyQ6JqVqW4tDkr5zug.jpeg" /><figcaption>The cafe</figcaption></figure><p>A new building yet to be finished cosmetically, with a single cafe in its left corner on ground floor, with an overlook I could see industrial design with themes of brown and beige. We stared, expecting it to be under construction too. The owner, with desi charm, rushed towards the door, which we could see through the glass, opened it and invited us to have a coffee. My judgement of the cafe being built with industrial design was held true. Pseudo-Antiques, black metal ornaments hosting green fake plants, on the modernized neolithic walls, cafe counter all with the shades of brown and crema. We occupied ourselves to 3 plus 1 plus 1 Beige sofa with embroider netted runners. We ordered some cold brews n lattes and some sandwiches.</p><p>The inauguration was two days ago, said the owner and we had long conversation on the food distribution channel from Delhi, sourcing his pre-made, ready to cook food, we assumed. He was making them locally, the cafe offered fresh ready to cook food. Kind of oxymoron-ing me, but it was fresh as he intended. We stepped out after an hour of chat and food.</p><p>Noticed a slight loose nut on the aux light mounted to our bike, on our way to the cafe, we had to fix it before we resume. The duffle bag was unloaded with all the spare parts and tools to service the bike ourselves. Opened my toolkit to find the right Allen key. The right size was found, and we pulled out the nuts to apply a liquid sealant to keep it from loosening recurrently. We foresaw the need of such niche items into spares. Experienceee! This helps the nuts to stay put even with extreme vibrations at higher speeds. We adjusted the lamp orientation and there we completed our first of many maintenance works.</p><p>We rolled out again. Highways were boring, so skipping to the fun part. The next stop was… Oh wait I remembered something. We had mounted intercoms to our helmets, allowing us to communicate with each other at distance without stopping. The 3 hours on highway, we tested the connectivity, range, quality, obstacle impact on range, and the most important aspect auto-reconnection. I had the infamous BluArmor c60 freshly installed and Sooraj had a Cardo he’s been using. BluArmor has a bad repute among riders for its state of reliability. I purchased it based on accessible servicing process, compared to Cardo and Senna. The connectivity lasted for line-of-sight 300meters without much of system noise. Beyond which we had robotic noise from the algorithm and disconnections. When the distance between us was cut short the devices connected back automatically. Wind noise was cancelled extremely well, which means the audio we hear is clear to comprehend the need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n6OPuHQ34Il3HqD23tIKqw.jpeg" /><figcaption>Helmet setup with a GoPro and BluArmor</figcaption></figure><p>Our chats were on setting up communication protocols. What key(cuss)words to use at each juncture of the journey. The most used words being <strong>UNDO </strong>which is call sign for undulations on the road, <strong>PODI PODI </strong>which is Malayalam for dust or loose gravel on the roads, <strong>PASHU PASHU PASHU </strong>for all the wandering, prayed for, fought for, and godly cows dead or alive on the 100kmph limited highways.</p><p>Off we go to the Bollywood’s fav notoriety hiding spot, Pathankot. The place was introduced to me as such. Nothing notable except the road quality is “<em>there are roads between the pothole</em>” scenario, for 75kms under extreme heat. Fatigue sets in quick; No amount of coffee could recover the drowsy me from this. Overmore, the bags we corded got loose, had stop and redo the racking, just tighter. I was counting the trucks and cars we were overtaking, while we were moving like a snail. Trucks helped in lifting the dust of the pothole laden roads, a scene such as Tollywood style reveal of the protagonist, balaclava saved the day, as seen by oncoming traffic.</p><p>We escaped the bouncy roads and reached a small township. Exposed buildings with unfinished walls. Tax benefit, someone explained about unfinished constructions. Everything looked like it was yet to dry after a heavy storm. Multiple busses on the road dropping off school kids in bright whites. JK registered vehicles became prominent now, indicating the border.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGQqn9gL7nbW5Diq-nnAaw.jpeg" /></figure><p>Here our networks stopped working. It was bordering Jammu district. The internet and cell network of SIMs registered in other states were not permitted here, unless it is a postpaid service with KYC done. For the love of God, I had converted my Airtel to postpaid service and missed the KYC between work and travel planning. Fortunately, Sooraj, was able to purchase a prepaid card with KYC done from this town. I could get one too, but then, one card was enough. He enabled hotspot for me to use the network, so didn’t have any rationale to buy another one. So we learnt, the J&amp;K is a hard stop for external SIM cards. Either a local prepaid SIM card or Postpaid from any other state, both with KYC done. So do consider carrying Aadhaar card.</p><p>There was a small desi bakery, adjacent. Most Indian bakeries as usual would sell all kinds of snacks but fresh bakes. We asked for Samosa-Bhaji and chilies, since it was being cooked fresh outside the sitting area. Chilies helped cool us down a LOTTTTT! A hot cup of tea after chili made it even better.</p><p>My Hindi skills came in handy to converse with the locals. Thanks to Kendriya Vidyalaya, I didn’t learn any academic Hindi. My Hindi had this local slang learnt from cities I lived in, like Pune. They were excited to see two men walking in with armored costume, the touring jacket and enduro boots, riding Kerala registered bikes. There is a respect for bikers who travel long distance and that’s a product of curiosity instilled. The locals don’t see this quite often. KL stood out among JK, PB, and HR registered vehicles there.</p><p>We had to move again fast. The roads were averaging a 30 to 40 KMPH, which slow as per our plan. Our ETA refreshed to be late evening now.</p><p>Finally, back to skipping highways, YAY!!! We have now reached Anantnag, where we could decide to move towards Srinagar or Pahalgam. Pahalgam it was. The sky turned to golden hour, we had to rush before sun really sat down for breakfast at San Francisco.</p><p>We rallied up to starry lights we saw in the distance, followed the path taken by oncoming traffic, we had no clue which place to stay, no rooms were booked in prior. The bikes were on its toes as riders can’t see much with the stock headlamps, we couldn’t feel much of the road at that speed, and could only sense the really cold breeze slipping in. We sighted few incandescent lights set in an array, glowing from afar, we set out for that destination, an estimate of 5kms.</p><p>Finally, a settlement, dark asphalt with stone footpaths, and European streetlamps, a slight rush of the river. We didn’t scout around for a cheap stay, we saw a mountain view resort, checked into a suite room with a view. The crisp climate made me hesitate to step out. Dinner had to be done, rather a lavish one, forecasting subpar food ahead of us. It was about 10PM and all the shutters were rumbling down. I ordered a soup, at the last open shutter, and he, a bowl of Jeera rice. Had to add salt and pepper ourselves to the soup, bland as we chefs call it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*d_ff9dr86c3CllrwAqnDWQ.png" /><figcaption>Night view at Pahalgam</figcaption></figure><p>The dinner was done, and we walked around for some meds for Sooraj, he had to get Diamox, we were yet to climb any altitude to realise we didn’t have to take it, and we saw travel size Oxygen cylinder, we got that too. We had to get our step count up, the entire length of Pahalgam was open for us, I didn’t wear any winter clothes at sub 10 degrees in Celsius, good decisions are made like this. It was a deliberate way to get used to the climate, not medically valid. Stressful for many maybe. We had planned a malai ice cream, by then the ice cream vendor closed down.</p><p>Now, you might think we went for a sleep. No! We checked up our bikes like a masseuse grazing through skin. Applied chain lubricants, checked for any loose nuts and thumbs up for a go ahead tomorrow.</p><p>We went into planning mode now at 11PM, to amend departure window for the next day. The distance was a mere 90kms. We reached a consensus to sleep 8 full hours.</p><p>Lights off!<br>Something sparked outside with a loud after-noise. Thundershower!<br>See you tomorrow morning!</p><p><strong>Expenses until Day 2:</strong><br>Budget: None<br>Total spent: 72,000 INR</p><p>Find the Day 1 of the series <a href="https://medium.com/@Zakbasil/the-experience-insignia-my-tale-of-ladakh-2069c28982ba">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b75a2f358da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The experience insignia: My tale of Ladakh]]></title>
            <link>https://medium.com/@Zakbasil/the-experience-insignia-my-tale-of-ladakh-2069c28982ba?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/2069c28982ba</guid>
            <category><![CDATA[ladakh]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[biketrip]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 06:29:28 GMT</pubDate>
            <atom:updated>2026-10-21T04:41:36.114Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Sep 2nd 10 AM:</strong> We, my buddy Sooraj and I, reach Chandigarh by train. A warm and planned city, welcoming bikers from all around India to tour The Himalayas. Accessible in all manners, service, food, electronics, healthcare and more. Sounds more like a regular city. After a 2 mile walk with all the bags, we checked into a nearby hotel. Had a vegeterian breakfast, while traveling it is safer to consume vegeterian than non, had our breakfast, late, as usual as IT humans. Took rest.</p><p>5 mins later, we scouted the place for our supply, ended up with Blinkit order, coincidentally for 2026 Rupaiyah. Printed copies of official docs, hydration salts, dark chocolates (because I like it, you should too), protein bars, a 33L duffle bag, water and random stuff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbOgmlV4_3rBHw2njM4ESA.jpeg" /></figure><p>We walked about a mile eastward from our hotel, to the warehouse and trucking belt of Chandigarh, Daria, to collect our bikes from the shipping vendor, SafeExpress. This vendor was recommended by my colleague, Rahul sir, at work. The bikes were intact, exceptionally packed. A green cuisioning and cling wraps and taped. Except Sooraj got both his front indicators SNAPPEDDDD! Yellow flag. The packaging was great according to us, since indicators are a quick fix and no other mechanical or cosmetic issues were in notice. Hence recommended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*uLzI_d8eCcSdZT1DAgMWtQ.png" /></figure><p>There will be errors to packaging, considering the covers and cushions are generic, may impact delecate protruding elements of your bike. Shipping by SafeExpress was way better handled than Railway though. Apart from their intolerable processes, Railway requires you to empty the fuel tank, and they’d try to start the vehicle with no fuel to verify zero fuel, with FI engines that’s the first step to mess up the fuel system, major decision factor. SafeExpress mandated very low fuel level, not empty, which makes it safer for shipping as well as getting to refuel at the destination.</p><p><strong>The Plan next<br></strong>One characteristic of us travelling is than we don’t plan until pressure build, Not even at the remotest place from comfort zone, be like water my friend (Hiyaa!). Often than not, the idea of travelling is to take least amount of decisions, either delegate (Use case for our friend Claude) or perform in small quantities. Our elegant plan for the next day was to reach Leh, just that. Fortunately, there are two ways to reach here. One through Manali and another through Srinagar. Both are faaaaaaar for a single day touring. Could stretch, but why!</p><p><strong>The route through Manali first </strong><em>(This would give continuity to the story because we chose Srinagar, hehe).</em></p><p>From Chandigarh to Manali, 263Kms about 5 hours says Google. Doable. From Manali to Leh is 425Kms about 7 hours says Google, doable. Lots of attractions such as Gata loops, Tanglang La, Nakee La pass and google the rest (tired of saying “and more”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FcLH0mps24Bu8BXUvgIvag.png" /></figure><p>As experienced bikers, we computed for elevation, from other experienced folks and just looking at the number of loops or hairpins on a map. More the loops and pins, more elevation gained. Distance is like money now, the cheapest variable of all. The new variables to our equations were, rate of change of elevation, oxygen levels, heart rate, food availability with rate of metabolism, landscape stability, lethargy, AMS, access for vehicle maintenance, road width, and traffic (considering one side is a deep chasm and other is a shooting stone elevation).</p><p>We being us, considered just the elevation gain, proportional to AMS gain. Since this route has many hairpins, the rate of elevation gained is pretty high, for sea-level dwellers. Our main goal, to tour the Ladakh, would’ve been compromised if any of us attracted AMS.</p><p><strong>9PM same day, we decided for Pahalgam. <br></strong>Told you, we don’t plan like you do. We met Sooraj’s second cousin, Hrishi, he works here in CH, such an enterprising character, will share his story in upcoming chapters. His boss, Prerak, made a confer with us about the itinerary, hearing no sign of a plan, he put forward a beautiful idea of visiting the war ruin-nation, Pahalgam, then move towards Srinagar.</p><p>To reach Pahalgam, we must move in the same direction as Srinagar. A deviation from Anantnag will route you to Pahalgam. Maps work perfectly here, so use it.</p><p><strong>The Srinagar route, connecting to NH 1<br></strong>Distance to Pahalgam: 530Kms 12Hrs says Google.<br>Distance to Srinagar: 90Kms 2 Hours says Google (we were pseudo-racing maps, hence all the “says Google”, stopping that).<br>Distance to Leh: Didn’t matter, because is was beautiful. A route through terrors of Zojila pass and the forever recovering war memorial Kargil. 413Kms filled with rage, anxiety and slight patriotism in memoirs of the area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBRSsmpU6QO__WQ-v7-Chw.png" /></figure><p>Enters Vinayak, a friend of Sooraj. He was in on the plan. He reached Leh by flight 2 days prior to our Leh itinerary. He did his acclimitization procedure and planned to solo travelle towards Sonmarg. That’s 90% of the route from Srinagar-Leh, NH 1. From his view, the route offered a gradual gain of elevation, alleviates the need of AMS readiness.</p><p>We chose to ride together towards Leh, the two of us, via Srinagar via Pahalgam, later join Vinayak at Sonmarg. None of the above technical reasonings mattered hence.</p><p>Diamox was considered to chemically rework on blood pressure to combat AMS, in case. No need to consume Diamox at all, for this route. We took it late at night, out of FOMO, FOMO on Leh. It had no side effects so far. We were also drinking more water that AI data centers, as Altman intended.</p><p><strong>Consult your doctor before any medical interventions are made.</strong></p><p>Had dinner with Hrishi at a local favorite, in the city, at 10pm. We took our bikes at night with full fuel and consumed it to roam locally. The food was okay-okay for southerners, since we love the blend of spice so it burns the acids of our stomach. Reached back to the room pretty late, anticipating 4 hours of sleep, a bad decision.</p><p>So after all the prepping at CH, we roll out before sun. <br>We’ll talk the next day, if network persist.</p><p><strong>Expenses till Sep 2nd:</strong><br>Budget: None<br>Total Spent: INR 64,000.00</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2069c28982ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Specificity of a software solution: Part 1]]></title>
            <link>https://medium.com/@Zakbasil/specificity-of-a-software-solution-part-1-6cca174766d2?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cca174766d2</guid>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[specialization]]></category>
            <category><![CDATA[big-data-architecture]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 07:15:50 GMT</pubDate>
            <atom:updated>2024-08-13T07:15:50.382Z</atom:updated>
            <content:encoded><![CDATA[<p>In a world of generalized solutions with development benefits and complexities, where does specialized solutions fit in?</p><p>Every software ever developed has masked the complexities from its end users. As a developer you may have realized there are two kinds of software development pattern: Platform design and specific solutioning. These patterns determine the path forward for the development team and business client more that the end users.</p><blockquote>Platform design</blockquote><p>A paradigm that generalizes a solution so much so that there is high reusability within the scope of business domain. Again, the word reusability masks many details. It abstracts the following increased developer growth, productivity and utilization, better documentation, reduced dependencies and reduced code redundancies.</p><p>Like we say, <strong>“Devil is in the Details”</strong>, platform design keeps the specificity low, never zero.</p><p>Be it the UI of Swiggy (Food delivery app) or Integration software for Big Data solutions that aggregate data from various systems and markets, both require a unique interface for the data to be transformed for consumption by the platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*ee24ajGy8kSEToF-5NJXGw.png" /></figure><p>Swiggy hosts its mobile application with a wireframe, which is a platform-like design, that engages the user with server rendered content for quick deployments without friction of user action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qrO7OMp1mQG6V4-B" /><figcaption>Photo by <a href="https://unsplash.com/@claybanks?utm_source=medium&amp;utm_medium=referral">Clay Banks</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Big data solutions that are hosted to integrate warehouses to Business Intelligence solutions, if designed as a platform would require interfaces to collect data from SAP S4 HANA and Dynamics 365 separately, each interface to accommodate the nomenclature and content types. Rest assured in D365 is hosted for India and St. Louis, both would have completely different business structures. Hence different markets would demand separate interface to comprehend the data.</p><p>Design of Platforms can be explained as a collection of connector interfaces and core logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmWiZYENH0oKk9MVcdO2cg.png" /><figcaption>Platform Implementation of a Big Data Solution</figcaption></figure><p>We can observe the platform core is a single instance to be scaled, analyzed and managed. While the number of connecting interfaces have increased. Each connector has separate implementation of fetching data (API, SFTP or dropped to shared ADLS by source) and transformation to a unique format understood by the core system.</p><p>It is easy to scale the solution for more volume of data per market. And it would require development effort to scale out to a new market. Regarding the scale up where more volume data is dumped, not all the reports from various sources require equally scaled compute resources, hence the pricing of the compute must follow pay per use method.</p><p>Data management is another development area to focus on idempotency, data versioning and data consistency while meeting SLAs set by the client.</p><p>The best part of Platform design is the resilience. In the upcoming part where high specificity solution is discussed, we’ll see how resilience is difficult to develop. In view of a platform design, we primarily have to focus on one core system for its failsafe runtime. Metadata collection, and performance analytics of a platform requires less effort to be diagnosed and rectified.</p><blockquote>Thank you for reading through.</blockquote><blockquote>More explanations of the design in the next part. Follow the tab for the series.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cca174766d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PySpark Performance Improvement: Part 3]]></title>
            <link>https://medium.com/@Zakbasil/pyspark-performance-improvement-part-3-c4f1e66adfb7?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4f1e66adfb7</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[pyspark]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Fri, 13 Oct 2023 06:06:15 GMT</pubDate>
            <atom:updated>2023-10-13T06:06:15.907Z</atom:updated>
            <content:encoded><![CDATA[<p>Utilizing the resources to the peak, by understanding the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LvOb6f9gcKR81BpZ" /><figcaption>Photo by <a href="https://unsplash.com/@benjaminlehman?utm_source=medium&amp;utm_medium=referral">benjamin lehman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We have seen the example of mapping delivery to shipment in <a href="https://medium.com/@Zakbasil/pyspark-performance-improvement-part-2-8a84479ce04e">previous post</a>. The below code was referred for naive solution, which may take 10 hours to 10 days, depending on the number of records. Generally, the record counts span over Millions.</p><pre>Delivery = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_dlry&#39;)<br>Shipment = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_shipment&#39;)<br><br>Delivery.createOrReplaceTempView(&#39;Delivery&#39;)<br>Shipment.createOrReplaceTempView(&#39;Shipment&#39;)<br><br>finalDF = spark.sql(&quot;&quot;&quot;<br>SELECT *<br>FROM <br>  Delivery d<br>INNER JOIN <br>  Shipment s<br>ON <br>  d.ShipmentId = s.ID AND<br>  d.loc = s.loc<br>&quot;&quot;&quot;)</pre><p>Let’s discuss the optimization.</p><ol><li><strong>Select the required fields and ignore the rest.</strong></li></ol><p>Almost always we get unnecessary data or fields from source systems, based on design and interface being used. This leads to increased memory usage at runtime for sark applications. There are scenarios in which you may get random error with application closure. The core issue is memory utilization and overflows.</p><p>Reducing the number of fields will reduce shuffle time and shuffle load. Update the code as follows:</p><pre>Delivery = spark.read\<br>                      .format(&#39;csv&#39;)\<br>                      .option(&#39;header&#39;,True)\<br>                      .load(&#39;filepath_dlry&#39;)\<br>                      .select(&#39;ID&#39;,&#39;loc&#39;,&#39;QTY&#39;,&#39;HAZMAT&#39;,&#39;Buyer&#39;,&#39;ShipmentId&#39;,&#39;ETA&#39;)<br><br>Shipment = spark.read\<br>            .format(&#39;csv&#39;)\<br>            .option(&#39;header&#39;,True)\<br>            .load(&#39;filepath_shipment&#39;)\<br>            .select(&#39;ID&#39;,&#39;shipper&#39;,&#39;currentLoc&#39;,&#39;ETA&#39;)<br><br>Delivery.createOrReplaceTempView(&#39;Delivery&#39;)<br>Shipment.createOrReplaceTempView(&#39;Shipment&#39;)<br><br><br>finalDF = spark.sql(&quot;&quot;&quot;<br>SELECT<br>  d.ID AS DeliveryID,<br>  s.ID AS ShipmentID,<br>  s.currentLOC AS TrackingLocation,<br>  d.ETA AS ExpectedDelivery<br>FROM <br>  Delivery d<br>INNER JOIN <br>  Shipment s<br>ON <br>  d.ShipmentId = s.ID AND<br>  d.loc = s.loc<br>&quot;&quot;&quot;)</pre><p>The above program is optimized by memory, since a major portion of memory is omitted from being stored in dataframe.</p><p>2. <strong>A repartition on larger dataset</strong></p><p>The count of records is in order of Millions. Hence, repartitioning can help reduce the overheads of sequential execution.</p><p>Repartitioning both the Delivery and Shipment might result in poor performance. Example, we partition both by 10. Each partition of delivery must join records of each shipment partition. 10X10, 100 joins with 99 linear shuffles are required to compute the result.</p><p>To solve, partition the larger set by a feasible number and use a set of attributes to shuffle the data. Here we assume Every Shipment contains one or more delivery. So, count of delivery is larger than shipment.</p><p>Code changes as follows:</p><pre>Delivery = spark.read\<br>            .format(&#39;csv&#39;)\<br>            .option(&#39;header&#39;,True)\<br>            .load(&#39;filepath_dlry&#39;)\<br>            .select(&#39;ID&#39;,&#39;loc&#39;,&#39;QTY&#39;,&#39;HAZMAT&#39;,&#39;Buyer&#39;,&#39;ShipmentId&#39;,&#39;ETA&#39;)<br><br>Delivery.repartition(10,&#39;ShipmentID&#39;,&#39;loc&#39;).write.mode(&#39;overwrite&#39;).format(&#39;csv&#39;).option(&#39;header&#39;,True).save(temppath_to_dlvry)<br>Delivery.unpersist()<br><br><br>Shipment = spark.read\<br>            .format(&#39;csv&#39;)\<br>            .option(&#39;header&#39;,True)\<br>            .load(&#39;filepath_shipment&#39;)\<br>            .select(&#39;ID&#39;,&#39;shipper&#39;,&#39;currentLoc&#39;,&#39;ETA&#39;)<br><br> <br>#this logic can be explored by the developer for specific enviroment<br>files = FetchAllPartionedFiles(Delivery)<br><br>FinalDF = None<br><br>for i in files:<br>  DeliveryPart = spark.read\<br>            .format(&#39;csv&#39;)\<br>            .option(&#39;header&#39;,True)\<br>            .load(i).coalesce(10)<br>  DeliveryPart.createOrReplaceTempView(&#39;Delivery&#39;)<br>  <br>  listID = DeliveryPart.select(&#39;ShipmentId&#39;).rdd.flatMap(lambda x:x).collect()<br>  listLoc = DeliveryPart.select(&#39;loc&#39;).rdd.flatMap(lambda x:x).collect()<br>  <br>  #Modify the filter condition as needed<br>  shipmentPart = Shipment.filter(col(&#39;ID&#39;).isin(listID) or col(&#39;loc&#39;).isin(listLOC)).coalesce(10)<br>  Shipment.createOrReplaceTempView(&#39;Shipment&#39;)<br><br>  partFinalDF = spark.sql(&quot;&quot;&quot;<br>  SELECT<br>    d.ID AS DeliveryID,<br>    s.ID AS ShipmentID,<br>    s.currentLOC AS TrackingLocation,<br>    d.ETA AS ExpectedDelivery<br>  FROM <br>    Delivery d<br>  INNER JOIN <br>    Shipment s<br>  ON <br>    d.ShipmentId = s.ID AND<br>    d.loc = s.loc<br>  &quot;&quot;&quot;)<br><br>  if FinalDF == None:<br>    FinalDF = partFinalDF<br>  else:<br>    FinalDF = FinalDF.union(partFinalDF)</pre><p>Since, we are joining Delivery to Shipment, we know the keys ShipmentID and loc are used as part of the join clause condition. After partition I am storing the partitions into a temporary storage. and un-persisting the dataframe. this removes the context of the dataframe delivery hence freeing up some memory.</p><p>Collect all the locations and ShipmentIDs of the DeliveryPart dataframe, and filter the Shipment dataframe for fetching relevant shipments ignoring the rest for current partition of delivery.</p><p>The processing reduces from millions of records joining with another Million to 100K joining with 100K records, 10 times.</p><p>Above tweaks, helps the performance improve over 10-fold, theoretically. The operational time reduces and hence the cost reduces. Post the change system efficiency also improves and can be verified in spark dashboard.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4f1e66adfb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PySpark Performance Improvement: Part 2]]></title>
            <link>https://medium.com/@Zakbasil/pyspark-performance-improvement-part-2-8a84479ce04e?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a84479ce04e</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[pyspark]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Wed, 11 Oct 2023 08:20:53 GMT</pubDate>
            <atom:updated>2023-10-11T08:20:53.071Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Apart from built-in functionality, performance of a system lies in its execution path. We discussed in <a href="https://medium.com/@Zakbasil/pyspark-performance-improvement-part-1-04a2e3bed7bd">part 1</a>, about how an SQL query is used to describe the end result rather than instructions to compute it. We’ll look into the idea of how to understand data for performance.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*71wZzKSNk-_92v4B" /><figcaption>Photo by <a href="https://unsplash.com/@jankolar?utm_source=medium&amp;utm_medium=referral">Jan Antonin Kolar</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Businesses provide many kinds of data, such as in supply chain businesses provide data on Inventory, Sales, Orders, Delivery, Transportation, Billing, Commodity and so on. Data is collated over many sources, like Salesforce, SAP or 3rd Party sources that aggregate data from warehouse management systems to order creation systems.</p><p>Most often, the middleware or the service that integrates the data sources and preprocess for reporting, uses various logics to transform and validate, including cross data references such as verifying if the commodity exists in master data before processing and sending for inventory reporting.</p><p>Developers use keywords such as join, filter, flatmap, aggregate, grouping and more to perform the transformation and validations, using built in functions or as an SQL query.</p><blockquote><strong>Execution pattern for PySpark</strong></blockquote><pre>Student = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_student&#39;)<br>Class = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_school&#39;)<br><br>#region QuerySample<br>Class.createOrReplaceTempView(&#39;Class&#39;)<br>intermediateDF = spark.sql(&quot;&quot;&quot;<br>SELECT *<br>FROM <br>  Class<br>WHERE<br>  totalStudents &gt;= 100;<br>&quot;&quot;&quot;)<br>intermediateDF.createOrReplaceTempView(&#39;intermediateDf&#39;)<br>Student.createOrReplaceTempView(&#39;Student&#39;)<br>finalDF = spark.sql(&quot;&quot;&quot;<br>SELECT s.*<br>FROM <br>  intermediateDf i<br>INNER JOIN <br>  Student s<br>ON <br>  s.ClassId = i.Id<br>&quot;&quot;&quot;)<br><br>#endregion<br><br>finalDF.show()</pre><p>Spark is lazily executed. Logics for transformations can be written in any number of sequential steps. Spark reads all the instructions to form an optimum execution path. And hence the problem begins.</p><p>Above program does the same, where student details are displayed where the student belong to a class with more than 100 students in population. The effective result is displayed, as we mentioned. On a PySpark notebook, write the query in the QuerySample region in separate cell from other lines o program, observe the cell execute within seconds, even if the source data consists of millions of records. This is lazy loading.</p><p>Pypsark executes eagerly (opposite of lazy) when an <strong>action</strong> command is triggered. Action commands are functions which require immediate computing, example count(), display(), write, show(), rdd:collect() etc.</p><blockquote><strong>How to optimize query execution based on the data</strong></blockquote><ol><li><strong>Environment optimization</strong></li></ol><p>Spark Applications use distributed and parallel computing, achieving faster throughput. It utilizes nodes, executors and containerization using Docker/K8 in the backend, abstracted from the user.</p><p>Developer can configure the scale at which the operations to be executed based data volume, number of sources, operations involved, and most importantly accepted latency by business.</p><p>Having too many nodes does not help but incur cost of owning the processing power, whilst a very low number can throttle the operation.</p><p>2. <strong>Repartition</strong></p><p>As mentioned in the previous part of the series, Spark works by splitting the data into partitions and processing in a distributed system. Repartition can help distribute the data across nodes for parallel processing. Data is shuffled or moved across the nodes if there are many source files are to be joined or aggregated in parallel.</p><p>For large dataset partitioning is prevalent. Since shuffle or data movement is required, the optimization is to reduce the shuffle read/write, and target resource usage to executing the program.</p><p>Small datasets need not be partitioned unless needed.</p><p>Spark has a default partitioning, by 200 max partitions. Use coalesce or repartitions to control the partitions of data.</p><p>3. <strong>Broadcasting</strong></p><p>Smaller datasets need not be partitioned as partitioning and data movement might utilize more time, compared to the operations on the data.</p><pre>country = broadcast(spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_ctry&#39;))<br>Shipment = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_shipment&#39;)<br><br>country.createOrReplaceTempView(&#39;country&#39;)<br>Shipment.createOrReplaceTempView(&#39;Shipment&#39;)<br><br>finalDF = spark.sql(&quot;&quot;&quot;<br>SELECT s.*<br>FROM <br>  country c<br>INNER JOIN <br>  Shipment s<br>ON <br>  s.Location = c.country<br>&quot;&quot;&quot;)</pre><p>Broadcast() is a function that let spark know, to distribute the data as is to each node instead of default partitioning. Example: A list of countries is smaller than shipment details. To identify count of shipments at predefined destinations, we can join the two data. We can broadcast countryList and partition shipments data.</p><p><strong>4. Bucketing</strong></p><p>Bucketing is a Machine Learning concept for preprocessing the data for training yet can be used to preprocess our big data.</p><p>Bucketing is a technique rather than a built-in function. We can achieve bucketing by utilizing repartition and filter. The concept is to group together data that are alike based on attributes than can significantly partition the data.</p><p>In the above example, Shipments data can be in order of million transactions. Our new task is to find all delivery details for corresponding shipments. Which asks for more resources to execute a join with millions of records crossed with another source of millions of records.</p><pre>Delivery = broadcast(spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_dlry&#39;))<br>Shipment = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(&#39;filepath_shipment&#39;)<br><br>Delivery.createOrReplaceTempView(&#39;Delivery&#39;)<br>Shipment.createOrReplaceTempView(&#39;Shipment&#39;)<br><br>finalDF = spark.sql(&quot;&quot;&quot;<br>SELECT *<br>FROM <br>  Delivery d<br>INNER JOIN <br>  Shipment s<br>ON <br>  d.ShipmentId = s.ID AND<br>  d.loc = s.loc<br>&quot;&quot;&quot;)</pre><p>The above program can take anywhere from 10 hours to 10 days.</p><p>Optimizing the same will be discussed in detail later. The task is left to the user until next post in the series.</p><p>Happy Reading! Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a84479ce04e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PySpark Performance Improvement: Part 1]]></title>
            <link>https://medium.com/@Zakbasil/pyspark-performance-improvement-part-1-04a2e3bed7bd?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/04a2e3bed7bd</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 14:14:22 GMT</pubDate>
            <atom:updated>2023-10-09T14:24:51.081Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Working with huge datasets can be daunting without a framework such as PySpark for Python environment. Performance of Spark applications have higher expectations with the distributed computing in place.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3AKwTPj4JAeeUOVz" /><figcaption>Photo by <a href="https://unsplash.com/@mbaumi?utm_source=medium&amp;utm_medium=referral">Mika Baumeister</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>All developers must have written one SQL query all whilst learning Programming under various paradigms. Observing closely, every SQL query executed specifies how the data is presented finally and not how to fetch and process the same.</p><p>Similarly, a developer can write a Spark application, keeping the fundamentals abstracted from the business logic.</p><p>We want the Get faster Quick and Easy methods. The following methods are two of many.</p><ol><li><strong>Use of DeltaLake Table</strong></li></ol><pre>from deltatable import DeltaTable<br>df = DelatTable.ForPath(spark, path_to_deltaTable)<br>df.show()</pre><p>DeltaTable is an optimized file system, which provide higher compression and faster readability while IO is performed. It provides a database like features like update and delete while also provision a version control system maintaining all versions of the data. Which can be optimized further to store only the latest instance or version.</p><p>All while CSV is simply readable for human when displayed on local machines, DeltaLake tables are stored in a PARQUET format, unreadable to human as it is a compressed text.</p><p>Use case would be when historical data is required to be processed with latest data. The source files maybe in a CSV format. Once the CSV is read, the data can be written into a detlatable for retrieval as historical data.</p><p><strong>2. Optimum use of Coalesce and Repartition</strong></p><pre>Repartition: repartition(numberOfPartitions, cols*)</pre><p>Repartition allows to distribute or redistribute the data records in dataframe into number of partitions based on the parameters mentioned. We can partition based on various column names of the selected dataframe.</p><pre>df = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(path_to_source_file)<br>df.repartition(1).write.mode(&#39;overwrite&#39;).format(&#39;csv&#39;).option(&#39;header&#39;,True).save(path_to_destination)</pre><p>Reparition works by a shuffle mechanism at the end which can be controlled by mentioning the columns field. The default mechanism also does a shuffle based on most optimum logic.</p><p>Repartition has the ability to scale up the number of partitions to any positive number.</p><pre>Coalesce: coalesce(numPartitions)</pre><pre>df = spark.read.format(&#39;csv&#39;).option(&#39;header&#39;,True).load(path_to_source_file)<br>df.coalesce(1).write.mode(&#39;overwrite&#39;).format(&#39;csv&#39;).option(&#39;header&#39;,True).save(path_to_destination)</pre><p>Coalesce allows to split or combine partitions of dataframe. Coalesce does not have shuffle mechanism at the end.</p><p><strong>What is optimum between the two?</strong></p><ol><li>Coalesce when a single partition is needed. When writing as a CSV, we may not need a shuffle mechanism hence Coelesce is suitable.</li><li>Coalesce when a reduction in partition count is expected when shuffle is not required.</li><li>Repartition when parallel processing using all the executors are needed.</li><li>Repartition when number of partition to be increased based beyond 200. Coalesce has a cap on partition count at 200, same as the default number of partitions in spark system.</li><li>Repartition when redistribution is needed based on key fields of the dataset.</li></ol><p>References:</p><ol><li><a href="https://delta.io/blog/2022-10-25-create-delta-lake-tables/">How to Create Delta Lake tables | Delta Lake</a></li><li><a href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.pandas/api/pyspark.pandas.DataFrame.spark.repartition.html?highlight=repartition#pyspark.pandas.DataFrame.spark.repartition">pyspark.pandas.DataFrame.spark.repartition — PySpark 3.5.0 documentation (apache.org)</a></li><li><a href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.pandas/api/pyspark.pandas.DataFrame.spark.coalesce.html">pyspark.pandas.DataFrame.spark.coalesce — PySpark 3.5.0 documentation (apache.org)</a></li></ol><p>Await the next part for more optimizations.</p><p>Thank you for the read. Happy coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04a2e3bed7bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Monitor Application Performance? — Part 3: Monitoring Database]]></title>
            <link>https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-3-monitoring-database-ad199f572e74?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad199f572e74</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[performance-management]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Fri, 28 Apr 2023 06:09:58 GMT</pubDate>
            <atom:updated>2023-04-28T06:09:58.129Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Monitor Application Performance? — Part 3: Monitoring Database</h3><blockquote>Database is pivotal point of any application software. It could be a flat file collection called blob storage, SQL servers, NoSQL servers and data lakes/warehouses. Database is a keyword in all of these types representing a collection of structures or likely data. Database is also referred to as a storage component of applications.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S4P1XKBazFKOBmve" /><figcaption>Photo by <a href="https://unsplash.com/@imgix?utm_source=medium&amp;utm_medium=referral">imgix</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Database performance is critical to an application performance, since there is an overhead in search and retrieval of data based on queries provided.</p><p>Monitoring involves collecting the following info:</p><ol><li>CPU: Server requests are concurrent and will induce throttlling at sql server. CPU metric helps us identify potential user path or code flow that triggers high utilization of CPU.</li><li>Memory: Every query utilizes memory to store the result temporarily, which can be exhausted if the query retrieves a huge dataset.</li><li>Disk I/O: Every read and write operation induces Disk usage. Query performance can be affected if net Disk usage is high. Similar to how your windows machine faces latency when disk metric is high.</li><li>Query performance: SQL server stores statistical data of query performance with identifiers. Slow performing queries can be retrieved from this table “<em>sys.dm_exec_query_stats”</em> and “<em>sys.dm_exec_sql_text”</em>.</li><li>Indexation: A developer might add indexes to a table based on an attribute of the table. This if overdone can cause latency and memory utilization to store the index files.</li><li>Database size: Overtime, with scale up of businesses, data quality and quantity increases. It is important to monitor the size of the active database, as it grows every query has to process all the data to fetch the results, which would incur in degradation of query performance.</li></ol><pre>--Fetch top 10 SQL queries that took more than 1s to excecute and have more than 10 occurences.<br>SELECT TOP 10<br>    total_worker_time/execution_count AS avg_cpu_time, <br>    execution_count,<br>    total_elapsed_time/execution_count AS avg_duration,<br>    total_logical_reads/execution_count AS avg_logical_reads,<br>    total_logical_writes/execution_count AS avg_logical_writes,<br>    total_physical_reads/execution_count AS avg_physical_reads,<br>    (SELECT TEXT FROM sys.dm_exec_sql_text(sql_handle)) AS query_text<br>FROM <br>    sys.dm_exec_query_stats<br>CROSS APPLY <br>    sys.dm_exec_sql_text(sql_handle)<br>WHERE <br>    total_elapsed_time &gt; 1000000<br>    AND execution_count &gt; 10<br>ORDER BY <br>    avg_duration DESC</pre><p>Azure resources by default provide instance vise data of all the metrics. It also provides a portal to write queries to fetch worst performing Queries.</p><p>We have discussed about monitoring <a href="https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-1-customer-behavior-tracking-231d0b20ec38">Frontend</a>, <a href="https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-2-backend-application-performance-8eecb61eef40">Backend</a> and Database performance.</p><p>Follow the series to have implementations and further discussions of application performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad199f572e74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Monitor Application Performance? — Part 2: Backend Application Performance]]></title>
            <link>https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-2-backend-application-performance-8eecb61eef40?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eecb61eef40</guid>
            <category><![CDATA[performance-management]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Wed, 26 Apr 2023 11:03:15 GMT</pubDate>
            <atom:updated>2023-04-26T11:03:15.741Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Monitor Application Performance? — Part 2: Backend Application Performance</h3><blockquote>In the previous story we delved into the ideation for performance monitoring of <a href="https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-1-customer-behavior-tracking-231d0b20ec38"><em>User-end Applications</em></a>. <br><em>Let us look at how an eCommerce application in Azure can be monitored.</em></blockquote><p>Since we are interested in Azure Cloud Provider the language of interest would be C# with .NET Core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eZCvZVU4qOEP4LPEfeNnfg.png" /><figcaption>Azure Application Insights Dashboard (Source learn.microsoft.com)</figcaption></figure><p><strong>Request and response types:</strong></p><ol><li>CSR (Client-Side Rendering): Server requests that gives us a Json/xml URLs to other files or any raw data that is not rendered yet.</li></ol><pre>/**<br>* Assume the code requests for a content from localhost<br>*/<br>@Injectable()<br>export class ApiService {<br>    constructor(private http: HttpClient) {}<br> <br>    getBooks(){<br>        return this.http.get(&#39;http://localhost/library.Catalog.API/api/Book/List&#39;); <br>    }<br>}</pre><pre>#Assume the response as below<br>{<br>&quot;Author&quot; : &quot;J K R&quot;,<br>&quot;DateCreated&quot; : &quot;21-01-1998&quot;,<br>&quot;Name&quot; : &quot;Harry Potter&quot;,<br>&quot;Edition&quot; : &quot;1.2&quot;,<br>&quot;Genre&quot; : &quot;Fantasy&quot;<br>}</pre><p>A developer needs to render it with specific UI elements to represent the raw data is pleasant manner to the User. User has to wait for all the files to be downloaded.</p><p>2. (SSR) Server Side rendered: Instead of raw data server renders the data, creates a <em>View</em> ready to be displayed at user end application. Reduces User device rendering time and resource utilization. User can view the DOM rendered elements.</p><pre>@inject Microsoft.AspNetCore.SpaServices.Prerendering.ISpaPrerenderer prerenderer<br>//...<br>@{<br>//...<br>var prerenderResult = await prerenderer.RenderToString(&quot;ClientApp/dist/main-server&quot;);<br>}<br>//...<br>&lt;div id=&quot;react-app&quot;&gt;@Html.Raw(prerenderResult?.Html)&lt;/div&gt;</pre><p>The result is a HTML view rendered at Server End and delivered to Client device. SSR increases the throughput of the page in subject.</p><p>The most common approach is to use CSR. SSR is introduced for performance improvements in symbiosis with CSR.</p><p>The collectibles for CSR based solution are:</p><ol><li>Request info: If enabled and configured, Application insights in Azure collects the data regarding request throughput, counts, sender, location, machine that processed, response codes and so on. This gives insights into how well a feature is used, and its impact in production.</li></ol><pre>--Below is a KQL query in Azure to fetch top 10 worst performing requests<br>request<br>| where timestamp &gt;ago(24h)<br>| summarize avg(duration) by operation_name, url<br>| top 10 by avg_duration desc</pre><p>2. Data I/O metrics: Applications process data received from user through a request payload as well as that are stored in flat files, databases or cache. This is called I/O operations consuming more resources and time.</p><p>3. Memory Leaks: A phenomenon where the application fails to discard or release its allocated memory locations causing performance degradation. It can be detected using Profiling feature in Azure Application insights. This consumes resources to collect and store profiling data. Word of caution, use it only when needed to detect performance degradation after analyzing most other possibilities.</p><p>4. Background Jobs: You might want to collect or log certain aspects of the application usage, like eCommerce product metric and sales data being stored into a Data Lake at late night at Off working hours. A background helps reduce manual labor. Background jobs are triggered by events, schedule or manual trigger (Only for debugging).</p><p>5. Exception metric: Collection of exceptions raised in the runtime are logged here, includes the stack trace for debugging.</p><p>6. Dependency Metrics: Collection of nested requests, external requests, process calls, I/O calls logged per request at runtime. This helps identify point of failure or performance bottlenecks on a per component/service basis.</p><p>7. Performance counters: Application Uptime, Data regarding CPU, Memory, I/O, Network I/O utilization of the application are logged here. This data can be used to extrapolate the utilization of resources at scale, determine pricing models and manage costs.</p><p>8. Custom Metrics: Developer can create custom metrics, which are specific to the business use case, such as Purchase Process completion. This helps to identity the impact of a feature, to determine its ROI and the potential for future developments on that feature.</p><pre>//Example for creating custom telemetry<br>using Microsoft.ApplicationInsights;<br>using Microsoft.ApplicationInsights.DataContracts;<br><br>TelemetryClient telemertyClient = new TelemetryClient();<br><br>var metric = new MetricTelemetry();<br>metric.Name = &quot;CustomMetric&quot;;<br>metric.Sum = 1;<br>telemetryClient.TrackMetric(metric);</pre><p>These metrics can be queried using KQL or Kusto or be exported as excel workbook.</p><p>We’ll look into “Database performance monitoring” in the next post.</p><p>Thanks for reading. Keep exploring.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eecb61eef40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Monitor Application Performance? — Part 1: Customer Behavior Tracking]]></title>
            <link>https://medium.com/@Zakbasil/how-to-monitor-application-performance-part-1-customer-behavior-tracking-231d0b20ec38?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/231d0b20ec38</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 06:48:42 GMT</pubDate>
            <atom:updated>2023-04-20T06:48:42.249Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Monitor Application Performance? — Part 1: Customer Behavior Tracking</h3><p>Let us consider an <strong>eCommerce application</strong> as subject for this series of discussions. I would also refer to Azure as my cloud provider at certain points. Yet, this content would be transferable to other providers.</p><p>We have discussed the introductive contents in the blog “<a href="https://medium.com/@Zakbasil/application-performance-monitoring-f342cf192f5d"><em>Application Performance Monitoring</em></a>”.</p><p>The core requirement of monitoring is customer retention for profit making. Let’s start with that.</p><blockquote>Customer Behavior Tracking</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*irFbbqol_y9zwEvt" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For many it sounds unethical, for tracking their behavior in an application software. It is likely that you have “<em>Accepted</em>” the <em>T&amp;C</em> for the same to read this very blog post with Medium. Data Laws in the Operating and Serving countries provision privacy rights to its users. To which all service providers have to be diligently bound. This is an ethical practice to conduct service improvisation and optimization at product level with priority to User Privacy.</p><p><strong>What are the collectibles?</strong></p><ol><li><strong>User triggered events</strong>: A payment initiation, cancellation of an order, opening camera for scanning QR, etc. are all events that relevant to track. This allows to add new application features with real world scenarios.</li><li><strong>System Events</strong>: User switching to Dark Mode, Silent Mode or going offline are system events. This help adapt the application based on color codes, sounds, and offline usage.</li><li><strong>Code flow events</strong>: Login is User triggered event. Activity after receiving Auth token or 4XX response is handled by code. Any event that is abstracted from User Interface is code flow events. This helps debug the application exceptions and resolve it before it becomes a Priority Ticket.</li><li><strong>Page visits</strong>: Page views are essential for all digital products and blogs. There is monetization based on Page Views. Ad spaces and promoted products on eCommerce pages require analytics on how many total and unique views were obtained, to calculate ROI.</li><li><strong>Activity Throughput/Latency</strong>: Any content that is rendered to User is based on requests send to Server and response received by the User’s device. Connectivity, server response time, total time till first byte, are all factors that account for system performance. This helps identify User path that has bottleneck and help initiate analysis to identify which component caused the bottleneck.</li><li><strong>Usage Pattern: </strong>Every user has their distinctive behavior while using the application. Some do window shopping, while others hoard on clothes. The idea to identify usage pattern help understand classifications of user demography, time of day, frequency, time spend, etc. This helps scale the application for optimal performance and minimal costs.</li></ol><blockquote>Some snippets</blockquote><p>Here are simply collecting data from an Angular App with Azure Application Insights SDK.</p><ol><li>Install the SDK</li></ol><pre>npm install @microsoft/applicationinsights-web --save</pre><p>2. Import required packages in your component</p><pre>import { ApplicationInsights } from &#39;@microsoft/applicationinsights-web&#39;;<br>import { Injectable } from &#39;@angular/core&#39;;</pre><p>3. Create service and initialize properties and events</p><pre> logPageView(name?: string, uri?: string, properties?: any, measurements?: any, duration?: number) {<br>    this.appInsights.trackPageView({ name, uri, properties, measurements, duration });<br>  }<br><br>  logEvent(name: string, properties?: any, measurements?: any) {<br>    this.appInsights.trackEvent({ name, properties, measurements });<br>  }</pre><p>4. Call the methods to send data across</p><pre>// log a page view<br>this.appInsightsService.logPageView(URL);<br><br>// log an event<br>this.appInsightsService.logEvent(&#39;button_click&#39;, { button_id: &#39;submit_button&#39; });</pre><blockquote>The snippets are generic examples, you can start <a href="https://devblogs.microsoft.com/premier-developer/angular-how-to-add-application-insights-to-an-angular-spa/">here</a> for further reading. Play around the same to get more insights into development. If you have further questions, DM me on <a href="https://www.linkedin.com/in/basilskaria/">LinkedIn</a>.</blockquote><blockquote>That’s all for this blog. Thanks for reading through.<br>Will delve into more of cloud aspects with “<em>Backend Application Monitoring</em>” in the next post.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=231d0b20ec38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application Performance Monitoring]]></title>
            <link>https://medium.com/@Zakbasil/application-performance-monitoring-f342cf192f5d?source=rss-22dd81aa7aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/f342cf192f5d</guid>
            <category><![CDATA[application-performance]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Basil Skaria]]></dc:creator>
            <pubDate>Wed, 19 Apr 2023 07:09:59 GMT</pubDate>
            <atom:updated>2023-04-19T07:09:59.257Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Application Performance Monitoring is an essential aspect of project management for ensuring reliable, satisfying and consistent usage of applications in a digital environment. It provides performance and utilization insights of applications, identifying potential problems before they impact userbase.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IAmUX3H5MVitdFwP" /><figcaption>Photo by <a href="https://unsplash.com/@hostreviews?utm_source=medium&amp;utm_medium=referral">Stephen Phillips - Hostreviews.co.uk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>What is Application Performance Monitoring?</blockquote><p>Application Performance Monitoring is the process of monitoring and managing the performance of your digital product. It involves tracking and analyzing key performance metrics, such as request response times, resource utilization, and error rates, to identify potential issues that can impact user experience.</p><p>The primary goal of monitoring is to ensure that applications are running optimal to cost and performance aspects and meeting user expectations. It provides visibility to the User Interaction by tracking User<strong> </strong>Behavior, logging request metadata, logs of errors and exceptions at User end and Server end and so on.</p><blockquote>Why bother?</blockquote><p>Businesses today are traversing opportunities to minimize cost and maximize profits. One adoption is digital tech for multiple use cases such as CRM, ERP, Track and Trace, eCommerce etc. They enable organizations to deliver services to customers, streamline operations, and increase efficiency. However, the performance of applications can impact the user experience and, ultimately, the success of the product.</p><p>A detailed view on the requirement of a monitoring system for businesses:</p><ol><li><strong>Identify issues and Improve UX</strong>: Provides insights into the runtime behavior of applications, identifying errors and exceptions that can impact the user experience. Ex. When you eCart is loaded with unintended items at checkout. Could be a User application-level error.</li><li><strong>Reduce Downtime</strong>: Helps organizations identify and address performance issues before they cause downtime. This minimizes the impact on users and reduces the risk of lost revenue and reputational damage. Ex. Exam results published by universities, the peak utilization would be for login and forgot password pages.</li><li><strong>Optimize Performance</strong>: Enables organizations to identify bottlenecks of application, improving resource utilization, and reducing costs. Ex. Adding items to Cart is simple UI implementation, but your backend might get repetitive APi calls to add items to the cart. If the query is slow running it might end up as a bottleneck.</li><li><strong>Identify Trends</strong>: APM provides data on application performance over time, enabling organizations to identify trends and patterns. This can help organizations anticipate future issues and proactively address them. Ex. What are the general purchase patterns in an ecommerce site. Users prefer purchasing in the evenings.</li><li><strong>Measure ROI</strong>: Provides data on the impact of performance improvements, enabling organizations to measure the ROI of their Performance improvement investments. Ex. Usage of monitoring tools are costlier since it itself utilizes resources to collect data and present to admins. Which incurs a cost, issued by the service provider.</li></ol><blockquote>How does monitoring work?</blockquote><p>It works by monitoring the performance of applications in near real-time. It collects data on key performance metrics, such as response times, resource utilization (CPU, Memory etc.), and errors, and provides insights into the performance of applications.</p><p>Tools use a variety of techniques to monitor application performance, including:</p><ol><li><strong>Instrumentation</strong>: APM tools instrument applications with code that collects performance data, such as response times and resource utilization. Ex. Azure provides Azure Monitor to capture system metrics.</li><li><strong>Tracing</strong>: APM tools trace transactions through applications, providing insights into the performance of each component. Ex. Application Insights traces in Azure helps collate and query on request response or rendering times/performance.</li><li><strong>Log Analysis</strong>: APM tools analyze application logs to identify potential issues that can impact performance. Ex. Application Insights collects data such as requests made to the app and a bundle of child transactions involved, like and SQL statement and other API calls.</li><li><strong>Synthetic Monitoring</strong>: APM tools simulate user transactions to test application performance and identify potential issues.</li><li><strong>Real User Monitoring</strong>: APM tools monitor the performance of applications from the perspective of end-users, providing insights into user experience. Ex. Azure has provided SDK for Application Insights to be implemented in various frameworks and languages, for tracking real user behavior.</li></ol><blockquote>Conclusion</blockquote><p>Monitoring adds control over the product. Depending on ROI, it can be scaled for better User satisfaction and experience, directly impacting growth of the product.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f342cf192f5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>