ugur elveren's blog

In this article, I will discuss the Saga design pattern. First, we'll address some technical challenges of creating ACID transactions. Then, we'll explore the Saga design pattern and how to implement it.

Database Per Service Pattern

First, let's talk about microservice architecture and the database per service pattern. Basically, each microservice in an application has its own dedicated database. This allows each microservice to manage its data independently, making it easier to develop, deploy, and scale each service without affecting the others. For instance, in an online store, the user service, order service, and inventory service each have their own databases. This isolation improves flexibility, as each service can choose the best database type for its needs and makes the system more resilient to failures.

However, there are some drawbacks to this pattern. Data consistency and distributed transactions are two of them. Since each microservice operates independently, it can lead to potential inconsistencies when updates occur across multiple services. Data duplication across the system can also lead to synchronization issues. Each transaction needs to be distributed across the system. If a failure occurs, rollbacks must happen across the system, leading to another problem: distributed transactions.

What is the Saga Design Pattern?

The Saga design pattern is a method for managing long-running transactions in a microservice architecture by breaking down a complex transaction into a series of smaller, independent steps, each handled by a different service. If any step fails, compensating transactions are executed to undo the changes made by previous steps, ensuring data consistency across all services. This pattern can be implemented through choreography, where each service triggers the next step via events, or orchestration, where a central coordinator directs each step. First let’s talk about Choreography.

Read more...

In the last article, we discussed how dependency injection (DI) helps keep our app's parts separate, making them easier to handle and test. This time, I'll focus on an important part of DI in .NET: lifetimes.

I'll explain the different lifetimes in .NET. Transient, Scoped, and Singleton and how to pick and use them for your app.

Read more...

At my company, we hold a weekly “Lunch and Learn” event that I really like. It lets us share our experiences and expertise. Recently, during a chat with my colleagues, I got some basic questions about dependency injection (DI). This made me think that it would be a good idea to use one of these sessions to go over DI with the team. Also, I plan to write an article about dependency injection and its best practices. In the article, I'll explain what DI is, how to use it effectively, and what the best practices are.

Read more...

I often find my mind wandering to different topics, interrupting phone calls, meetings, or reading sessions. These thoughts take center stage, making it challenging to refocus on the original task.

Interestingly, this mental game sometimes proves helpful. Whether it's a forgotten task during a book or a work-related bug that surfaces while spending time with family, these moments can be both distracting and beneficial.

Read more...

The circuit breaker pattern stops a service from trying again to call another service when the previous attempts have failed multiple times. It's similar to electrical circuit breakers that automatically cut off the current when there's abnormal activity.

In a distributed environment, calls to remote resources may fail due to reasons such as application exceptions, timeouts, authentication issues, or overloaded systems. Usually, resilient cloud applications automatically fix these issues over time, and the calling application manages these errors using a retry pattern.

However, in some cases, these failures can persist, like when a service is down or systems are consistently overloaded. Excessive retries can create a cascading effect, overloading the same resource and impacting other resources as well. Repeated calls can impact both cost and performance.

At this stage, circuit breaker patterns come into play to address this issue. When the callee retries, it begins to assess the problem. If there's a specific error or if the error count surpasses the limit, circuit patterns activate, breaking the communication between the caller and the callee.

Read more...

The cloud is vast. Azure docs have around a hundred thousand pages, and AWS is just as big. Other cloud providers are out there too. Each gives you lots of apps, different rules, and dozens of integrations, so creating cloud-native ones has its challenges.

They're not identical, but big providers offer similar solutions. For example, Google Cloud Storage is like AWS S3 and Azure's durable function is similar to AWS step functions. Details and rules can differ, but the main idea of the tech is similar, along with the challenges.

Because problems are alike, solutions are too. We can group similar solutions and make templates for each group. Like a cooking recipe guides you to a tasty dish, these templates can be our guide to perfect solutions.

Read more...

In late August, southern California faced a mosquito invasion. These tiny pests seemed to appear out of nowhere, leaving their itchy marks on unsuspecting victims. Whether you had a bug screen or not, they found their way into your home, and you'd wake up with irritating mosquito bites. At first, you might not notice them, but as time passed, the incessant itching would become undeniable.

These mosquitoes were notorious for targeting ankles, leaving small, pink, and itchy bites. Sometimes, you'd wake up with not just one or two but possibly three or more bites. The constant itching would make you want to scratch your ankles, especially when walking. It was nearly impossible to scratch them all the time, like when driving, where you'd long for relief.

By the end of the day, you'd have scratched your ankles raw, and the next day, it would only get worse. Congratulations, you'd have itchy scars and mosquito bites.

After a few weeks, I had to confront the mosquito problem plaguing us. The constant itching was unbearable, and even my precious puppies were not spared. Seeing my dog helplessly bothered by these mosquitoes, I decided it was time to take action.

I began wearing socks before sleeping and opted to use the air conditioner instead of opening windows. It made a difference, and though I still spotted the occasional mosquito, I became adept at swatting them before they could bite. Sleeping in socks and long sleeves also helped.

One day, I had a fantastic night out with friends, celebrating something special. I returned home late, exhausted, and in my tired state, I forgot about the mosquito problem. I kept the window open to enjoy the ocean breeze, and by morning, I was covered in fresh mosquito bites. These pests had taken advantage of my lapse in vigilance.

I realized I needed to confront this problem head-on. Passive measures weren't effective. So, I declared war. I ordered bug zappers and mosquito-killing sprays. Before sleeping, I abandoned socks and long sleeves, choosing instead to check the lights and eliminate any mosquitoes. There were a few nights I forgot, but the bug zappers and previous efforts paid off. It was initially a bit scary and required effort, but I learned that ignoring the problem was more costly. My quality of life improved, and I woke up without disturbances. Occasionally, there were accidents, especially when I ventured outside my “castle.” I went shopping and returned with a couple of bites, but this taught me to be prepared. I learned to identify areas prone to mosquitoes and took precautions with repellent body spray.

The key was accepting that I had a problem, taking proactive steps to combat it, and arming myself with solutions to alleviate the bites during my ongoing battle with these pesky insects.

#mosquitoes #personal

Since the beginning of the pandemic, I've noticed a repetitive pattern of content on the internet across various platforms. Whether it's on Reddit, different social media sites, or news websites and popular blogs, the same or similar content keeps circulating. Additionally, Google searches have taken a peculiar turn. When searching in English, the results often differ from the same websites, and in other languages like Turkish, you might encounter clickbait websites with strong SEO but weak content.

I appreciated the user-friendly interface and the quality of the community on Hashnode. I read some excellent articles. After a few articles, my job changed, and life became busier, leaving me with little time to write more.

In the last few months, I've had some spare time and planned to write more. However, I encountered a hurdle. I realized I didn't need a development-centric blog; I wanted a space to share my thoughts on various topics. Unfortunately, this didn't align with Hashnode's rules, and it would feel out of place among the tech-focused blogs. Consequently, I decided to migrate my blog from Hashnode to Write.as.

Initially, I experimented with hosting my own instance on one of my servers and even on a Raspberry Pi, which turned out to be surprisingly easy. I opted not to use my EC2 instances due to cost concerns. While the Raspberry Pi experiment went well, I didn't want to rely on my home internet to host a blog. So here I am, writing this post with my Write.as account. While I haven't made my first payment yet, I've already updated the CNAME record. After this post, I plan to transfer my old posts from Hashnode and import them into my new blog. I've already exported all my posts to a JSON file, although I'm unsure about the importing process; I'll figure that out after completing this post.

#Writefreely #personal

Azure Functions and Azure Durable Functions

Microsoft Azure is a constantly expanding collection of cloud services. Among these services, Azure Functions and Azure Durable Functions are critical in enabling serverless computing. In this article, we will look at Azure Functions and Azure Durable Functions, distinguish between the two, and learn about the key concepts surrounding Azure Durable Functions.

Read more...

In my previous blog post, I created a script that controls the fan speed on my Raspberry Pi. However, I encountered a problem – every time I restarted my Raspberry Pi, I had to manually run the script again, which was not ideal.

In this blog post, I will demonstrate how to automate the execution of any script using Systemd. Systemd is a system and service manager for Linux operating systems.

There are several methods to run software as a background service in Linux, such as using crontab or .bashrc, among others. If you're interested in those methods, you can easily find more information online.

Read more...

Enter your email to subscribe to updates.