<?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 Kareem Ayesh on Medium]]></title>
        <description><![CDATA[Stories by Kareem Ayesh on Medium]]></description>
        <link>https://medium.com/@kareemayesh?source=rss-1392d12b4e43------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*--vejI4Zu0eIPE6jVmrJZA.jpeg</url>
            <title>Stories by Kareem Ayesh on Medium</title>
            <link>https://medium.com/@kareemayesh?source=rss-1392d12b4e43------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 13:59:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kareemayesh/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[Maximizing Value, Minimizing Costs: A Guide to Efficient Product Development for Startups]]></title>
            <link>https://medium.com/@kareemayesh/maximizing-value-minimizing-costs-a-guide-to-efficient-product-development-for-startups-a66922818196?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/a66922818196</guid>
            <category><![CDATA[mvp]]></category>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Thu, 06 Apr 2023 19:01:36 GMT</pubDate>
            <atom:updated>2023-04-06T19:01:36.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWjrbXWHjc5RLWVe5va_Qg.jpeg" /></figure><h3>Introduction</h3><p>In the fast-paced world of startups, reducing product development costs is crucial to achieving success. High costs can arise from a myriad of factors, and understanding these issues is the first step to overcoming them. In this article, we delve into the common reasons behind these escalating expenses and offer practical solutions to minimize them, ensuring a lean and efficient development process that maximizes value for your startup.</p><h3>Section 1: The Problem:</h3><p>Before we can successfully decrease the capital required for product development, it is essential to comprehend the factors that contribute to its high costs. Let us explore the common reasons behind the expensive nature of product development:</p><h4>Reason 1: The Maturity of Engineers</h4><p>Many software engineers often fail to grasp the true essence of “engineering.” The primary responsibility of an engineer is to deliver the highest possible value within the constraints of a given timeframe and budget. This implies that engineers must use their skills, knowledge, and resources efficiently and effectively to create solutions that fulfill the project’s objectives and requirements while adhering to the set deadlines and financial boundaries. However, the reality often deviates from this ideal.</p><p>A significant number of software engineers tend to focus on crafting the perfect technical solution, the most scalable system, or a technical tour de force using their current knowledge base. This approach can inadvertently result in increased product development costs or even jeopardize the entire project. By prioritizing technical prowess over delivering value within time and budget constraints, these engineers may lose sight of the ultimate goal: developing a product that meets the needs of its users and the business.</p><h4>Reason 2: Premature Optimization</h4><p>While providing technical mentorship to startups, I observed a common trend where engineers and occasionally other team members attempt to optimize their products even before the development phase begins. For instance, I have witnessed startups spend months building their product on the cloud in anticipation of high future demand. Similarly, I have seen others invest considerable time and effort in creating an ultra-secure authentication system before their product even goes live. Such preemptive optimization efforts not only inflate the required capital but can also pose a severe threat to the survival of the startup itself.</p><h4>Reason 3: Reinventing the Wheel</h4><p>Many founders embark on product development without utilizing readily available off-the-shelf solutions, either due to an obsession with building everything from scratch or simply being unaware of existing products. If you believe creating a solution from the ground up is more cost-effective than using an existing product, you may need to reevaluate your calculations. The most valuable resource at your disposal is time, and concentrating on validating your product should be your top priority. By leveraging pre-existing solutions, you can save time, reduce costs, and maintain focus on what matters most — bringing your product to fruition.</p><h4>Reason 4: Open Feedback Loops</h4><p>Feedback is essential for growth and learning; without it, we are left to make decisions based on guesswork rather than grounded in reality. A surprising number of engineers and product managers do not place enough importance on feedback. Imagine launching a product without built-in reporting mechanisms — how would you make informed decisions about its performance and improvements? Relying on assumptions can prove detrimental to your product’s success.</p><p>Feedback should be an integral part of the development process, and it does not necessitate a significant investment, thanks to the plethora of modern tools and products available in the market. Beyond facilitating well-informed decision-making, closed feedback loops enable you to respond swiftly to any issues or changes concerning your product, ensuring its continuous improvement and adaptation to user needs.</p><h4>Reason 5: Misguided Methodology Adoption</h4><p>Engineers often adhere to best practices, methodologies, architectures, and so on. At first glance, this seems beneficial, doesn’t it? Unfortunately, it’s not always the case, and here’s why: Before adopting a specific development methodology, it’s crucial to comprehend the underlying value system, as it may not be appropriate for your particular situation. For instance, Test-Driven Development (TDD) has been widely embraced by engineers, many of whom have little understanding of the rationale behind its use. So, what’s the issue with not grasping the value system? It inevitably leads to the incorrect implementation.</p><p>This isn’t to suggest that TDD is an inherently flawed process; on the contrary, it’s an excellent development methodology. However, its primary goals are to promote sound code design and shorten feedback cycles, rather than simply optimizing code coverage through excessive and unproductive testing. To fully benefit from any methodology, it’s essential to understand its underlying principles and apply them judiciously to your specific context.</p><h3>Section 2: Suggested Solutions:</h3><p>In this section, we will go through several effective solutions to reduce product development cost</p><h4>Solution 1: Emphasizing the Right Metrics</h4><p>The manner in which you assess people’s performance has a direct impact on their behavior, as individuals tend to optimize their efforts based on the metrics being measured. Therefore, evaluating your team’s performance is crucial, especially in a startup environment. It’s essential to select outcome-based metrics, as these are the most relevant indicators for startups. If you’re unfamiliar with outcome-based metrics, consider exploring DORA metrics as a starting point.</p><p>For instance, one of the four KPIs introduced by DORA is the lead time for changes, which measures the duration required to progress from idea to production. By adopting such a metric, you can focus on what truly matters for your startup. This approach is preferable to relying on traditional velocity or productivity-based metrics, which can be easily inflated and inadvertently misdirect your engineering resources.</p><h4>Solution 2: Fostering a Generative Culture:</h4><p>For engineers to align their expectations with yours, it is vital to provide them with sufficient context. I have encountered numerous founders who criticize their engineers for being inexperienced or ineffective, yet they fail to share adequate information about the business, its objectives, and its progress. To facilitate a thriving startup environment, it is essential to maintain a healthy flow of information and establish well-defined goals. Additionally, ensure that your objectives are value-driven and that your engineers comprehend the underlying value behind them. This approach promotes a generative culture, which fosters collaboration, understanding, and alignment among team members.</p><h4>Solution 3: Adopting a Continuous Delivery Approach:</h4><p>Continuous delivery is often misconstrued, with many associating it with intricate deployment and testing pipelines accompanied by complex approval processes to maintain software integrity. However, the essence of continuous delivery lies in consistently releasing your product in small increments, accompanied by a robust feedback loop. Achieving this involves streamlining the release process and establishing a solid feedback mechanism — neither of which need to be overly complicated. By selecting the right tools and steering clear of custom, over-engineered solutions, you can simplify the process considerably.</p><p>When evaluating any tool or solution for continuous delivery, consider two key questions:</p><ol><li>How long does it take to deploy my code?</li><li>Can I identify any issues affecting my users without waiting for their complaints?</li></ol><p>By ensuring a seamless release experience for your engineers, you can effectively implement a continuous delivery approach, leading to more efficient and responsive product development.</p><h4>Solution 4: Enhancing Your Toolkit:</h4><p>As a founder or product manager, it is essential to periodically dedicate time to exploring available products and tools that can ease your product development journey. This proactive approach might be the key differentiator for successful product managers and founders. Investigating available products not only provides an opportunity to leverage them to boost your startup, but it may also shift your perspective on how to design and develop your product.</p><p>Numerous websites and resources are available online to help you discover and compare various products on the market. By incorporating these resources into your regular exploration routine, you can stay informed about the latest tools and technologies, ultimately enriching your toolkit and empowering your engineering team to deliver outstanding results.</p><h4>Solution 5: Assemble Your Team Thoughtfully:</h4><p>The skillset of your team plays a crucial role in the success of your startup. When building your team, it’s important to seek out individuals with a specific set of attributes. Focus on recruiting adaptable, impact-driven engineers who possess strong communication skills and a sense of ownership. While it can be challenging to find professionals who combine these soft skills with excellent technical abilities, the effort is worthwhile.</p><p>The key takeaway is that soft skills are equally important as technical expertise, and in some cases, they may even hold greater significance. By carefully selecting team members who exhibit a balance of these qualities, you can create a dynamic and effective engineering team that is more likely to drive your startup towards success.</p><h3>Summary:</h3><p>Product development costs can be a significant hurdle for startups, but understanding the root causes and implementing targeted solutions can help overcome this challenge. We discussed five common reasons contributing to high costs, including the maturity of engineers, premature optimization, reinventing the wheel, open feedback loops, and misguided methodology adoption. To address these issues, we presented five actionable solutions, which involve emphasizing the right metrics, fostering a generative culture, adopting a continuous delivery approach, enhancing your toolkit, and assembling your team thoughtfully. By employing these strategies, you can optimize your product development process, reduce costs, and ultimately drive your startup towards success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a66922818196" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching Your Career: Essential Strategies for New Professionals]]></title>
            <link>https://medium.com/@kareemayesh/launching-your-career-essential-strategies-for-new-professionals-45c1c375d658?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/45c1c375d658</guid>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[profissional]]></category>
            <category><![CDATA[success]]></category>
            <category><![CDATA[career-success]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Mon, 27 Mar 2023 18:48:12 GMT</pubDate>
            <atom:updated>2023-03-27T18:50:23.838Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*b3ZERhxMH9JvKFqmdTQ1VA.png" /></figure><h3>Introduction:</h3><p>Entering the professional world can be an exhilarating and challenging experience. As you embark on this new journey, it’s essential to equip yourself with the right tools and strategies to navigate the complexities of building a successful career. This article will delve into several key areas that will help you establish a strong foundation and thrive in your chosen field. By understanding and implementing these concepts, you’ll be better prepared to overcome obstacles and create a fulfilling professional life.</p><h3>Beyond Technical Skills: Maximizing Your Worth by Delivering Value</h3><p>A common misconception that many starting professionals have is that gaining more technical skills will automatically increase their worth in the job market. While technical expertise is essential, it is not the only factor that contributes to career success and growth.</p><p>Value, in a professional context, encompasses the tangible and intangible benefits your work brings to an organization, clients, or colleagues. It’s essential to understand that the most talented employees with exceptional technical skills aren’t always the ones who receive the highest compensation. Instead, those who can effectively deliver value are often rewarded more generously.</p><p>Employers and clients are seeking individuals who can apply their expertise to create value and drive positive outcomes for the organization. For example, a software engineer with excellent coding skills may be able to create complex programs, but if they cannot communicate their work’s purpose or collaborate with their team, the overall value they bring to the organization may be limited. On the other hand, an engineer with a more diverse skill set, including strong communication and problem-solving abilities, can deliver greater value by working effectively with colleagues and contributing to the company’s strategic objectives.</p><p>To maximize your worth and advance in your career, focus on delivering increased value to your organization. This can be achieved by broadening your skills, taking on more significant responsibilities, and proactively identifying opportunities to improve processes or outcomes. As you demonstrate your ability to create value consistently, you’ll become an indispensable asset, making you a prime candidate for promotions and salary increases.</p><h3>The Mentorship Advantage: Guiding Your Path to Success</h3><p>Mentorship plays a pivotal role in the professional growth and success of individuals starting their careers. A mentor serves as a guide, helping you navigate the complexities of the professional world, and offering support and advice based on their own experiences. By seeking out a mentor who shares your values and has expertise in your desired field, you’ll be better equipped to tackle challenges, learn from setbacks, and capitalize on opportunities.</p><p>Mentors can provide invaluable feedback on your work, help you set realistic goals, and offer insights that may be difficult to acquire through formal education or training. Additionally, they can introduce you to influential individuals within your industry and expand your professional network.</p><p>To fully leverage the mentorship advantage, be proactive in seeking out a mentor and nurturing that relationship. Listen to their guidance, ask questions, and be open to feedback. By embracing the mentorship process, you’ll gain a wealth of knowledge, experience, and connections that will significantly enhance your career trajectory.</p><h3>Aligning Perspectives: Ensuring Career Growth Through Feedback</h3><p>A common pitfall for many professionals starting their careers is the assumption that they are performing well, without realizing that their managers may have a different perspective. It is crucial to understand whether you are doing a good job by proactively seeking feedback from your manager, rather than making assumptions about your performance.</p><p>To avoid misunderstandings and align your efforts with your manager’s expectations, establish a clear understanding of what success looks like in your role. Regularly schedule check-ins with your manager to discuss your performance, gather feedback, and identify areas for improvement. These conversations can provide valuable insights into your progress and help you adjust your approach as needed.</p><p>By actively seeking your manager’s feedback and understanding their expectations, you’ll be better equipped to deliver results that align with your organization’s goals. This proactive approach will not only help you ensure career growth but also foster a strong working relationship with your manager, paving the way for future success.</p><h3>The Power of Communication Skills</h3><p>Effective communication is a fundamental skill that can significantly impact your career success. People with strong communication skills possess a greater potential to secure jobs and excel in interviews, as they can articulate their ideas clearly, collaborate with others, and manage conflicts effectively.</p><p>Employers often prioritize candidates who can demonstrate excellent communication abilities, as they recognize that such individuals can contribute positively to team dynamics and organizational culture. In interviews, candidates with strong communication skills can more effectively convey their qualifications, experiences, and potential value to the company, which can lead to more job offers and career opportunities.</p><p>To enhance your career prospects and set yourself apart from the competition, focus on honing your listening, speaking, and writing abilities. This will ensure clear and concise communication with your colleagues, managers, and clients, ultimately leading to better collaboration and improved outcomes in your professional life. By mastering communication skills, you’ll not only increase your chances of landing a job but also lay the groundwork for long-term career success.</p><h3>Building a Professional Network: Securing Future Opportunities</h3><p>Developing a strong professional network is crucial for long-term career success, as it can open doors to new opportunities, job offers, and valuable connections. In fact, it’s estimated that 70% to 85% of jobs are filled through networking, highlighting its importance in the job market (source: LinkedIn). Actively engaging in networking activities can significantly improve your chances of securing future opportunities and advancing in your career.</p><p>To build a robust professional network, attend industry conferences, join online forums, and participate in professional organizations. Additionally, LinkedIn reported that 61% of professionals agree that regular online interaction with their network can lead to job opportunities (source: LinkedIn). Therefore, nurturing your existing relationships and offering help when possible is essential, as a strong network is built on mutual support and collaboration.</p><p>By consistently investing time and effort into networking, you’ll create a powerful resource that can help you secure jobs, gain industry insights, and broaden your professional horizons.</p><h3>Let’s Summarize</h3><p>In conclusion, launching a successful career requires more than just technical expertise. By focusing on delivering value, seeking mentorship, aligning perspectives through feedback, developing effective communication skills, and building a robust professional network, you’ll set yourself on a path to long-term success and fulfillment in your chosen field. Remember that the journey is as important as the destination, so be open to learning, adapting, and growing along the way. As you implement these essential strategies, you’ll be better prepared to navigate the complexities of the professional world, overcome obstacles, and ultimately, achieve a rewarding and prosperous career.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45c1c375d658" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upgrade your Brain ]]></title>
            <link>https://medium.com/@kareemayesh/upgrade-your-brain-332578282639?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/332578282639</guid>
            <category><![CDATA[brain]]></category>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[thinking]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Fri, 18 Feb 2022 17:35:43 GMT</pubDate>
            <atom:updated>2022-02-18T17:35:43.178Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*BmkqzuFR1IL4eH0-fDbW_g.png" /></figure><h3>Introduction:</h3><p>If you’re struggling to learn, it’s not due to an innate brain limitation. When it comes to our brain capabilities, there are so many misconceptions. People primarily believe that your brain capabilities are determined only by a person’s genotype.Your struggles with learning are due to either a limited mindset, limited motivation, or a lousy learning method.</p><h3>Important Note:</h3><p><em>This article is a summary of the book “Limitless” by </em>Jim Kwik<em>; it is not meant to replace reading the original book. It also includes my personal opinions and some quotes from other summaries written by other readers. You can find the original book </em><a href="https://www.amazon.com/Limitless-Upgrade-Anything-Faster-Exceptional/dp/1401958230"><em>here</em></a><em>.</em></p><h3>Before we start …</h3><p>We need to agree on one thing before moving forward, think of your brain as a muscle, you can train it whenever you want.</p><h3>Let’s start by introducing the 3Ms</h3><ol><li><strong>Mindset:</strong> Being “Limitless” is a mindset you need to have, having this mindset allows you to verify that any limitations are self-imposed and that your true potential is within your control.</li><li><strong>Motivation: </strong>motivation<strong> </strong>explains why people initiate, continue or terminate a certain behavior at a particular time. Your motivation is a combination of your purpose and energy, and additionally three small and simple steps. Which means we can control it. We will see how later in this article</li><li><strong>The Method: </strong>Methods are the procedures or processes for accomplishing something. In the context of allowing your brain to become “Limitless” the method is the process of learning how to learn, also called meta-learning.</li></ol><h3>Step 1: Change your mindset (Mindset M):</h3><p>Before moving forward, it is important to free your mind from negative ideas and beliefs that might limit your brain abilities. Do you think people with high IQs are geniuses? Yes? What about people with low IQ? If you think they are not geniuses then you’re one of those people that equate genius with one particular measurement of intelligence: IQ. There are several common lies you need to make sure you don’t believe in. I will list the 6 of the most important lies:</p><p>1.<strong> INTELLIGENCE IS FIXED:</strong> intelligence is a combination of attitudes and actions, and, more importantly is context dependant.</p><p>2. <strong>MISTAKES ARE FAILURES: </strong>Mistakes are a sign that you are trying something new, there is no such thing as failure. Only failure to learn.</p><p><strong>3: KNOWLEDGE IS POWER: </strong>Knowledge is not power. It only has the potential to be power. You can read this summary and learn everything in it, but if you don’t take it and apply the knowledge, it will be useless.<strong>Knowledge × Action = Power</strong></p><p><strong>4: LEARNING NEW THINGS IS VERY DIFFICULT: </strong>Sometimes it is hard to learn new things. However when you learn new ways how to learn, the challenge of learning new things can be fun, easier, and more enjoyable.</p><p><strong>5: THE CRITICISM OF OTHER PEOPLE MATTERS: </strong>Don’t take criticism from someone you wouldn’t take advice from. People will doubt you and criticize you no matter what you do. So it’s not others’ job to like, love, or respect you.</p><p><strong>6: GENIUS IS BORN</strong>: Genius is not born; it’s made through deep practice.</p><h3>Step 2: Build a powerful sustainable motivation (Motivation M):</h3><p>As we said earlier, motivation explains why people initiate, continue or terminate a certain behavior and this doesn’t mean that you have to enjoy this behavior.</p><p>Motivation is not something you wake up with or not. We put ourselves in a trance when we say, “I don’t have any motivation.” Motivation is not something you have; it’s something you build. And it’s entirely sustainable. Unlike a warm bath, it’s not something that you experience for a moment and then lose unless you heat it up again. Motivation isn’t derived from a seminar that temporarily pumps you up. It’s a process you have control over and can create it consistently by following the right recipe. Here’s the formula:</p><p><strong><em>Motivation = Purpose × Energy × S3</em></strong></p><p>When you combine purpose, energy, and small simple steps (S3), you get sustainable motivation.</p><p>Let’s now talk about the formula in detail:</p><p><strong>1. Purpose:</strong> A purpose is a reason one aims to achieve a goal while a goal is a point one wishes to achieve. Regardless of your goal, you need to make sure it is a <strong>SMART</strong> goal, this is an acronym for:</p><p><strong>A. S is for Specific: </strong>Your goal should be well defined. Don’t say you want to be rich; say you want to make a certain amount of money.</p><p><strong>B. M is for Measurable:</strong> If you can’t measure your goal, you can’t manage it. Getting fit isn’t measurable — running a six-minute mile is.</p><p><strong>C. A is for Actionable:</strong> You wouldn’t drive to a new town without asking for directions. Develop the action steps to achieve your goal.</p><p><strong>D. R is for Realistic:</strong> If you’re living in your parents’ basement, it’s hard to become a millionaire. Your goals should challenge and stretch you, but not so much that you give up on them.</p><p><strong>E. T is for Time-based:</strong> The phrase, “A goal is a dream with a deadline” comes to mind. Setting a time to complete your goal makes you that much more likely to reach it.</p><p><strong>2. Energy: </strong>motivation is all about energy management and optimization. Here are recommendations for generating limitless brain energy: follow “a brain diet” and make sure you get enough “brain nutrients”, it is also important to do regular physical exercise, you should also make sure you have a positive peer group. You should also consistently get enough sleep.</p><p><strong>3. Small Steps:</strong> Be kind to yourself, humans are lazy by nature so you should always make sure you take tiny steps toward your goal, please review my previous summary for Atomic Habits book to understand the importance of small steps and the formation of flow state, flow state is a mental state in which a person performing some activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity.</p><h3>Step 3: Change the way you do things (The Method):</h3><p>You’ve learned how to approach every day with a productive mindset, and you’ve learned how to do so with an optimal level of motivation. However, there’s one more M that differentiates limitless people from those who are encumbered by their limitations: method. Methods are the procedures or processes for accomplishing something. Now we are going to learn the science of accelerated learning and meta-learning in five areas: focus, study, memory, speed reading, and thinking.</p><ol><li><strong>Focus: </strong>Focus allows us to train our brain power on a particular task to burn through that task, the good news is you can train yourself to focus, you can think of concentration as a glowing ball of light that moves to different parts of your mind. In order to excel at concentration, you need to make yourself keep that ball of light trained on one spot in your mind for an extended period. If you’re having a conversation with someone, make a concerted effort to pay attention to nothing other than that conversation. de-cluttering your environment is also good way to stay focused.</li><li><strong>Study: </strong>Most people do not know how to study effectively, because they were never taught. Many people naturally assume they already know how to learn. Here are the best techniques that I’ve found that personally helped me a lot with learning how to study. I won’t delve deeper into them primarily because this isn’t an in-depth tutorial on how to study.<br>A. Employ Active Recall: Active recall is a process through which you review material and then immediately check to determine how much of it you’ve remembered. Read more about it <a href="https://aliabdaal.com/activerecallstudytechnique/">here.<br></a>B. Employ Spaced Repetition: it is an <a href="https://en.wikipedia.org/wiki/Evidence-based_learning">evidence-based learning</a> technique that is usually performed with <a href="https://en.wikipedia.org/wiki/Flashcard">flashcards</a>. you can read more about this technique <a href="https://collegeinfogeek.com/spaced-repetition-memory-technique/">here<br></a>C. Take Notes: Taking notes is a very critical thing, you need to make sure you are doing it efficiently, you will find plenty of resources online on how to take notes effectively but what I want to point out here is: you need to practice taking notes.</li><li><strong>Memory:</strong> Memory is arguably the most important part of the learning process. If you could not remember, then you could not learn anything. There is no knowledge without memory. Most people have less than ideal memory skills because they have been taught to memorize things by rote. Here are some important tips:<br><strong>A.</strong> Memorization is a discipline for the mind. Much needed in an age when so many minds are lazy, distracted, have little to think about or think sloppily. Memorization helps train the mind to focus.<br><strong>B.</strong> Technology makes our memory worse, don’t just “Google it” if you can remember it.<br><strong>C.</strong> Memorization creates the repertoire of what we think about. Nobody can think in a vacuum of information. To be an expert in any field requires knowledge that you already have.<br><strong>D</strong>. The exercise of the memory develops learning and memory schema that promote improved ability to learn. The more you remember, the more you can learn.<br><strong>E.</strong> You should consider doing memory exercises, it is just like any muscle and it needs training, you can read more about memory exercise <a href="https://www.everydayhealth.com/longevity/mental-fitness/brain-exercises-for-memory.aspx">here</a>.<br><strong>F.</strong> You should always have the motivation to remember.<br><strong>G.</strong> Maintain active focus in memory: Most people approach learning as a passive activity. They encounter information in books, notes, or lectures and if the material is absorbed, great! But if it is not, they feel that there is nothing they can do. This passive outlook is the hit-or-miss approach. It holds that if the information sticks, it’s more a result of luck and repetition than focus and skill. By taking a more active approach to learning, you will have greater results and the satisfaction that comes from involvement and personal awareness. Learning passively is weak; active learning is strong.<br>H. There are plenty of other techniques to improve your memory like visualization approach or association approach, you can read more about it <a href="https://www.memory-improvement-tips.com/best-memory-trick.html">here</a>.</li><li><strong>Speed Reading:</strong> Studies show that there is a direct relationship between your ability to read and your success in life. Skilled readers enjoy better jobs, higher incomes, and greater opportunities for success in all facets of life. The book “Limitless” shares 3 ways to improve your reading skills<br><strong>A.</strong> Reading Is Like Exercising<br><strong>B.</strong> Expand Your Peripheral Vision: Your peripheral vision is the span of letters or words that your eyes can see in a single glance. By increasing your peripheral vision, you will be able to see and take in more words at a time.<br>But I feel like those methods are not enough, they will just help you speed up reading (literary reading). If you are interested in my secret sauce on how to read a book every 1–2 days just reach out to me :)</li><li><strong>Thinking:</strong> Accomplishing something big often requires new approaches to thinking. An observation usually attributed to Albert Einstein posits, “We can’t solve problems by using the same kind of thinking we used when we created them.”. Jim mentioned a good technique to achieve this called “The thinking hats”, you can read more about this approach from <a href="https://www.mindtools.com/pages/article/newTED_07.htm">here</a>. But why is it important for us to have tools to help us think in different ways? Because people usually have a dominant way of using their intelligence. There are 8 known types of intelligence, you can read more about them <a href="https://www.simplypsychology.org/multiple-intelligences.html">here</a></li></ol><h3>Summary:</h3><p>Many of us limit ourselves with false beliefs about our intelligence or other abilities. But the truth is, you don’t have to be born a genius in order to succeed. You just need to cultivate your individual abilities and motivation. You do so by identifying your purpose and using that to push you forward. And then, it’s a matter of choosing the most suitable among the many great methods of studying, focusing, memorizing, reading, and thinking. That will make your learning truly limitless.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=332578282639" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Good Habits & Break Bad Ones]]></title>
            <link>https://medium.com/@kareemayesh/build-good-habits-break-bad-ones-792b0fb51683?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/792b0fb51683</guid>
            <category><![CDATA[habits]]></category>
            <category><![CDATA[success]]></category>
            <category><![CDATA[habit-building]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[management]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Sat, 22 Jan 2022 13:10:07 GMT</pubDate>
            <atom:updated>2022-01-22T13:10:07.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*L5XSuhYYrT5oMKOiqDuQIA.png" /></figure><h3>Introduction:</h3><p>Habit formation is the process by which a behavior becomes progressively more automatic through repetition.<br>Building good habits and breaking bad ones is very important since it can change our identity and our life completely.</p><h3>Important Note:</h3><p><em>This article is my personal summary for the book “Atomic Habits” by James Clear. And it is not meant to replace reading the original book. You can find the original book </em><a href="https://www.amazon.com/Atomic-Habits-Proven-Build-Break/dp/0735211299"><em>here</em></a></p><h3>How To Build Good Habits</h3><p>In order to build good habits, we will follow 4 simple rules:</p><ol><li>Make it obvious</li><li>Make it attractive</li><li>Make it easy</li><li>Make it satisfying</li></ol><p>We will explain those rules in detail later in this article</p><h3>How To Break Bad Habits</h3><p>We will simply invert the rules above</p><ol><li>Make it invisible</li><li>Make it unattractive</li><li>Make it difficult</li><li>Make it unsatisfying</li></ol><h3>Make It Obvious:</h3><p>We should make good habits cues obvious and clear to easily trigger a good habit, to achieve this we will use 2 strategies.</p><h4>1. Use Implementation Intention</h4><p>Yes we all want to exercise for 10 minutes daily, but wait? when? and where? does that really matter? Yes, it matters a lot!!</p><p>The easiest way to make something happen is to formulate a plan for it, for example, I want to do 10 minutes workout daily at 6:00 AM in my bedroom. It is not enough to say “I want to exercise for 10 minutes daily”, it is important to mention the details of the time and the location and any other details needed.</p><h4>2. Designing your environment</h4><p>Your surrounding environment is very important when it comes to sticking to a habit, you should always make sure cues are obvious in your environment, let me give you an example: if you want to read 10 minutes daily, leave the book on your desk, whenever you sit on your desk you should be able to see it, this will help trigger the habit, the book here is the cue that triggers your habit.</p><p>Another example, If you want to remember to take your medication each night, put your pill bottle directly next to the faucet on the bathroom counter.</p><h3>Make It Attractive</h3><ol><li>Temptation bundling is one way to apply a psychology theory known as Premack’s Principle. The principle states that “more probable behaviors will reinforce less probable behaviors”. Let me give you an example, if you want to watch Netflix for 20 minutes you should do that after 10 minutes of reading only, 10 minutes of reading = 20 minutes on Netflix.</li><li>Join a culture where your desired behavior is the normal behavior: Humans tend to fit in, bond with others, and earn the respect and approval of their peers, you should use this feature in your favor. For example, if your friends are not athletes, you are less likely to be an athlete yourself.</li></ol><h3>Make It Easy</h3><p>Unfortunately, our real motivation is to be lazy and to do what is convenient. We need to make sure our habits are as easy as possible. Let’s see how you can achieve that.</p><ol><li><strong>Reduce friction</strong>: Decrease the number of steps between you and your good habits. Want to exercise? Set out your workout clothes, shoes, gym bag, and water bottle ahead of time, this will reduce steps needed when you are about to exercise. Want to improve your diet? Chop up a ton of fruits and vegetables on weekends and pack them in containers, so you have easy access to healthy, ready-to-eat options during the week.</li><li><strong>Stop Procrastinating by Using the Two-Minute Rule</strong>: Downscale your habits until they can be done in two minutes or less. Repetition is better than perfectionism when it comes to building habits, and habits are built by repetition.</li></ol><h3>Make It Satisfying</h3><p>Humans tend to do things with immediate reward rather than doing things with delayed rewards. This is a fact about humans we can’t ignore. How to make our good habits satisfying then?</p><ol><li>Use reinforcement. Give yourself an immediate reward when you complete your habit. The reward might not be related to the habit itself, refer to our reading example we mentioned earlier 10 minutes of reading = 20 minutes on Netflix.</li><li>Use a habit tracker. Keep track of your habit streak and don’t break the chain.</li><li>Never miss twice. When you forget to do a habit, make sure you get back on track immediately.</li></ol><h3>How To Break A Bad Habit</h3><p>we will just invert building a good habit process:</p><h4>Make It Invisible</h4><p>Reduce exposure. Remove the cues of your bad habits from your environment. For example, if you want to stop browsing social media at work, make sure your phone is not on your desk, maybe put it in another room, or ask someone to hide it for you.</p><h4>Make It Unattractive</h4><p>You can use temptation bundling the other way around, you should maybe bundle a bad habit with something you don’t like, for example, if you smoke a cigarette you should give your friend 1$.</p><h4>Make It Difficult</h4><p>You just need to increase friction, if you watch TV so much make sure to unplug after each time you watch it, maybe ask someone to hide the remote control. If something is hard to do it is less likely to happen, and you should make sure bad habits are not easy anymore.</p><h4>Make It Unsatisfying</h4><p>You might need to create a habit contract. Make the costs of your bad habits public and painful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=792b0fb51683" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Our AWS Infrastructure]]></title>
            <link>https://medium.com/@kareemayesh/scaling-our-aws-infrastructure-652844b00eb0?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/652844b00eb0</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Sun, 12 Apr 2020 15:27:22 GMT</pubDate>
            <atom:updated>2020-04-12T15:27:22.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5x4igfgkXC_iNIMQxwUWg.png" /></figure><p><em>|This article is written by </em><a href="https://www.linkedin.com/in/kareem-ayesh-9a407b128/"><em>Kareem Ayesh</em></a><em> and </em><a href="https://www.linkedin.com/in/ysr-sayed/"><em>Yasser El-Sayed</em></a><em>.</em></p><p>Meddy was founded in 2016 and has since had a lot of success thanks to the scale it hit. In 2019 we celebrated our 100,000th bookings and 3 millionth user served, on top of a <a href="https://www.forbesmiddleeast.com/innovation/startups/meddy-raises-25m-in-series-a-round-eyeing-uae-expansions">Series A funding ⚡🔌️</a>.</p><p>Meddy has gone through a lot of technical changes in the past four years. This article serves as a technical proposal to an infrastructure for a growing tech startup. We will be talking about the initial point of the infrastructure 4 years ago, all the problems we’ve faced over the years, and the incremental solutions that we’ve implemented in the order we’ve implemented them.</p><p><strong>If you’re an aspiring CTO of a growing startup this article will benefit you greatly.</strong></p><h3>Our Monolith</h3><p><em>I remember the CEO telling me that his code is better than any piece of code that I’ve written, when I asked why he said “Because it’s been used by thousands”… and he’s right.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*66Gjkd-WYQsgdt97.png" /><figcaption>Monolithic Infrastructure</figcaption></figure><h3>Technical Debt</h3><p>Having a monolith alone is not a problem. It’s just natural for most monoliths evolve gracefully and turn into Frankensteins, and that’s exactly what we did.</p><p>That being said this also meant that a lot of problems will manifest throughout the lifetime of the project, and surely a lot of problems did.</p><p>However, it wasn’t technical problems that we were worried about, it was the prospect of not being able to solve them.</p><p><strong>The existence of a monolith meant that problems were equal to dead-ends.</strong> It’s only natural that the more features were requested the more problems would manifest, solving these problems is just as natural as creating the features.</p><p>An initial refactor and update to the infrastructure was paramount to set up the growth of the application and in turn have potential solutions for potential problems on all fronts. That way new feature requests never spawned a series of uh’s and um’s or worse “<em>I don’t think that’s possible right now</em>”.</p><h3>Stepping Stone</h3><p>Data persistence was a big sore problem in the current monolith. Image uploads, the database and the logs all had to be backed up on the root filesystem and used when new instances needed to be spun up. Since there was no staging instance at that point testing happened on production and <strong>the server failed all the time, endangering our data!</strong></p><p>Another big worry that needed to be addressed was deployment. Deployment was done by SSH and git pull from our Github origin with no type of script to automate starting new processes, run tests and report failures.</p><h3>Solution</h3><p>It was clear that we needed some change; we decided that along with application code changes that we would have a small infrastructure change that would move the database and the file uploads to separate services.</p><p>These three problems were solved by using three AWS services:</p><ul><li>Using <a href="https://aws.amazon.com/rds/">RDS</a> to manage the Postgres database</li><li>Using <a href="https://aws.amazon.com/s3/">S3</a> to store the Media uploads</li><li>Using <a href="https://aws.amazon.com/elasticbeanstalk/">ElasticBeanstalk</a> to manage deployments</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UnMXbRzb2U7w7s47.png" /><figcaption>Separate Data Sources ✔</figcaption></figure><p>Just to re-iterate, the overall changes that we did in this project didn’t result in much of an improvement in the infrastructure. This separation just meant future problems in the application didn’t damage anything sensitive. Additionally, since there is only an application on the main EC2 instance, then that meant that any additional resource can exist on separate servers or services without issue.</p><p><strong>This wasn’t perfect:</strong></p><ul><li><a href="http://www.celeryproject.org/">Celery</a> and <a href="https://redis.io/">Redis</a> were on the same server as the application itself</li><li>The frontend application was a hybrid render between <a href="https://angularjs.org/">AngularJS</a> and <a href="https://www.djangoproject.com/">Django</a> which choked the processors at times</li><li>Logs were stored on the file server (nowhere else 😬).</li></ul><p>At that point, volumes were low and we didn’t have a lot of services or even features so these problems were tolerable.</p><p>Nonetheless, this project laid out a very important stepping stone for what has turned out to be a very robust summit.</p><h3>Search</h3><p><strong>Search was frustrating as it took a long time and was not very accurate.</strong> We were using an implementation of <a href="https://stackoverflow.com/questions/43156987/postgresql-trigrams-and-similarity">Trigram Similarity</a> from Postgres to implement search. On large amounts of records it wasn’t the fastest and search on multiple fields wasn’t accurate at all.</p><p>Most importantly, you can’t really control the behavior of these searches. We wanted to keep track of all the issues we had with these search queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S6Tpf6WBiNA2GzQm.png" /><figcaption>A Google Sheet containing all the improvements to search we want to do</figcaption></figure><p>Whenever we would have an errant behavior we couldn’t resolve the behavior with the current implementation.</p><h3>Solution</h3><p>Search takes up a lot of resources from the instances that it’s within. Instead of just expanding the instance and running a search application within it we decided to launch a separate service that ran <a href="https://www.elastic.co/">ElasticSearch</a> on-premise on an EC2 instance. Whenever a new record would be created or updated, we would update an index in the EC2 instance. There would also be a cronjob that updates the entire index periodically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NqoiOaU45bozJSvJ.png" /><figcaption>Add ElasticSearch ✔</figcaption></figure><p>This resulted in a much faster and better controlled search that we’ve iterated over and over without much change to the image running on our ElasticSearch service.</p><h3>Load Balancing</h3><p><strong>We experienced a 10 second downtime on every single deployment.</strong> Deployment was taken care of by ElasticBeanstalk. At a lower level, EB runs both the new (ondeck) and old (current) applications in parallel and does a symlink once all the execution scripts are successful. Since we were using one server, this symlink would cause 5–10 second downtime that needed to be resolved.</p><h3>Solution</h3><p>To fix this, we needed to have <a href="https://rollout.io/blog/rolling-deployment/">rolling deployment on multiple servers</a>. This was a relatively simple endeavor that required to just have an <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html">Application Load Balancer</a> in front of an Autoscaling group that was managed by our ElasticBeanstalk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Aq8nnHGxk6Z9-863.png" /><figcaption>Add Load Balancing ✔</figcaption></figure><p>Rolling deployment adds an overhead of testing and longer deployment times but removes downtime altogether.</p><h3>Rendering and SEO</h3><p>We were using a hybrid render where the Django application would serve a partly rendered HTML and that would run the AngularJS application on the client. This caused many problems:</p><ul><li><strong>Our rendering was slow and choked our dev team and our servers.</strong> Our servers required a lot of processing power to be able to render and was <a href="https://docs.djangoproject.com/en/3.0/topics/performance/#alternatives-to-django-s-template-language">an unavoidable bottleneck</a> with our response times. Even development became difficult because we needed to code a change multiple times. At some point even changing a single tracking event was a hardship.</li><li><strong>Poor build system resulting in high load times.</strong> We were using our own build system since there was no AngularJS build manager for a hybrid render, and our own system had a lot of bundling inconsistencies and caching issues that resulted in unoptimized builds and high load times. This was also a hassle to change and improve.</li><li><strong>Website would occasionally hang for 5–10 minutes. </strong>When we get a spike of requests from users or bots the server would open too many connections with the database, causing the database to hang. This happened <strong>every week at the end of 2019 after our Series A brought Meddy more business. </strong>The reason was because Django opens a database connection and keeps it open until the rendering of the HTML is over! Due to too many database connections the server would hang and eventually serve a 504.</li></ul><h3>Solution</h3><p>Soon after our Series A we embarked on switching our code from a Hybrid Render to a purely Client Side Render. For this to work we had to work on making a lot of changes to the way the backend serves requests.</p><p>We decided to use an S3 bucket as a static hosting for our frontend with <a href="https://aws.amazon.com/cloudfront/">CloudFront</a> distributing the responses. CloudFront also gave us the option to attach <a href="https://aws.amazon.com/lambda/">Lambda</a> functions to have very granular control over the requests we needed.</p><p>One of the main reasons that we did a hybrid render was a worry that SEO would be tarnished with a dynamic render; <a href="https://community.cloudflare.com/t/anyone-else-in-the-recent-days-getting-small-attacks-from-facebook-bots/89019">and one of the main reasons that our website was hanging was due to request spikes caused by bots</a>. Both these problems would be solved by a pre-rendering our pages and serving the pre-rendered pages to bots which is perfect for SEO.</p><p>To do so we used a service called <a href="https://prerender.io/">prerender.io</a> which pre-rendered requested pages, cached those pages and served those pages to bots. We added a bot detection mechanism based on User-agent of the HTTP request in a Lambda Edge function used by our CloudFront distribution. Whenever a bot is detected, they’re redirected to <a href="https://prerender.io/">prerender.io</a> to get their cached pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NpJ8kW8Ho135S2W6.png" /><figcaption>Add Pre-rendering and Bot Detection ✔</figcaption></figure><p>It’s important to note that once we hit 300,000 pages and prerender.io cost was very high, we decided to have our own on-premise prerender service. We implemented our own caching mechanism using S3 and <a href="https://aws.amazon.com/fargate/">ECS Fargate</a> to host the service.</p><h3>Sharing Caching and Scheduled Tasks</h3><ul><li><strong>Caching resources were not shared between servers. </strong>Caching resources not being shared between servers meant that some requests would be cached and others won’t be. Additionally, we’ve had problems with Redis being on the servers; Redis has scheduled data dumps on the server which on two occasions caused downtime when disk space was eaten up by another service.</li><li><strong>Scheduled tasks needed to run on one server. </strong><a href="https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html">Celery Beat</a> had built-in functionality to run tasks on a certain date and time and feeds off an event stream that was stored as a table in the database. This is very useful for us because we use it to send reminder SMSs for appointments at specific intervals before and after the appointment. If it was kept on the servers there would be duplicate tasks executed which would cause conflict mainly within our notification module.</li></ul><h3>Solution</h3><p>Since we are now using multiple servers over a load balancer, the backend has to share a similar caching server. For that purpose we used <a href="https://aws.amazon.com/elasticache/">ElastiCache</a>. This was extremely simple to set up. The more challenging aspect was our asynchronous task manager which was managed on each server with Celery Beat.</p><p>To decouple this we would create events on a new service that would invoke those events by making a request to the backend. The event would just store the function that needs to be called, the arguments of that function and the time it needs to be invoked in. This would have its own database that the backend would populate events on request of the backend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5nE9NTgZcHu04sD2.png" /><figcaption>Move Redis and Celery to Separate Services ✔</figcaption></figure><p>We called this new service <strong>Celery Beet</strong> since we thought that the Celery Beat library missed such a great opportunity.</p><p>This has one major downside: you can’t pickle since invoking requests is done through HTTP. However, since <a href="https://docs.celeryproject.org/projects/kombu/en/stable/userguide/serialization.html#serializers">Celery recommended against using Pickle</a> we never used it in our code.</p><h3>Redirections and Link Shortening</h3><p><strong>Redirection for shortened links happened on the client side application.</strong> Moving to a purely client side application meant the server can’t serve a 301 on a link because all requests go to the S3 bucket. When a redirection has to happen from /x to /y, the client side application has to check with the server about /x and inform the Prerenderer that this page was meant to be redirected by adding an extra parameter to the DOM. To ensure that the Prerenderer picked up on that we created a page that says “Redirecting you please hold on for a second” that added that extra parameter.</p><p>This was fine for internal redirections since we don’t have that many. It wasn’t ideal for link shortening because we wanted the users to just land on those shortened links without having to wait, especially when we needed to redirect outside Meddy.</p><h3>Solution</h3><p>To solve this we created two Lambda functions that feed off a Dynamo table that has hashes and links. One Lambda function is tasked with shortening and another Lambda function is tasked with redirecting the shortened links.</p><p>Additionally, we used an API gateway as an entry point for our redirection lambda function and attached it to a new (shorter 😁) domain for these URLs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TXPFj77c5aFAc5hC.png" /><figcaption>Add Link Redirection using Lambda ✔</figcaption></figure><p>This works very well because Lambda provides virtually no maintenance, usage graphs and our database doesn’t have to contain a large table of these redirections.</p><h3>Logging and Monitoring</h3><p><strong>The need for better logging was dire.</strong> An increase in the number of server requests meant that we can no longer rely on rotating logs on our filesystem because the files would rotate so quickly. On top of that, the number of services we were using was increasing, and pulling files from the different filesystems was a nightmare. Having a centralized logging system for all your services is a challenge.</p><h3>Solution</h3><p>We decided to build a service for logging and monitoring using <a href="https://grafana.com/oss/loki/">Grafana Loki</a>. Loki is an open source horizontally-scalable, multi-tenant log aggregation system inspired by Prometheus. While Grafana is an open source analytics and interactive visualization software. Essentially, we used Loki as a logs aggregation tool and Grafana to visualize these logs.</p><p>The idea was to have our different services push logs to an HTTP endpoint opened in the Loki service. Loki would then index them and store the logs in binary format in S3 and the indices in a DynamoDB table. This gave us a way to look for certain tags in our logs like a specific status code or a specific log level. It also gave us the ability to query our logs and even apply aggregation functions on them like count the amount of logs that have specific tags over last 5 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0XOM-qVFrU6fpHCo.png" /><figcaption>Add Logging &amp; Monitoring using Grafana Loki ✔</figcaption></figure><p>For event monitoring we use Grafana but this time with AWS <a href="https://aws.amazon.com/cloudwatch/">CloudWatch</a>. Grafana acts as a client for CloudWatch and polls data on demand to visualize it.</p><p>To be able to push logs to Loki as mentioned above, we had to use different techniques from different services like building handlers on our application servers and Lambda functions attached to data dumps. The Lambda functions were used to parse the Load Balancer and CloudFront logs from S3 and then pushing them to Loki.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZTfXtYpoVPbAKMpf.png" /><figcaption>One of our many screens on Grafana</figcaption></figure><p>Using this mix of data handlers and CloudWatch we were able to have a centralized logging and monitoring system for everything in your infrastructure, you have one place to monitor everything.</p><h3>All Together</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PGO-YZTPXHv5Pfje.png" /><figcaption>All done!</figcaption></figure><p>This is probably our most favorite article to date! This shows a lot of growth due to a lot of challenges that we went through. The most exciting thing is that this is still the beginning for Meddy.</p><p>Thank you for reading! Stay tuned for more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=652844b00eb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Large Scale Web Apps Memory Management]]></title>
            <link>https://medium.com/@kareemayesh/large-scale-web-apps-memory-management-b6dc06237836?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6dc06237836</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[large-scale-apps]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Fri, 14 Sep 2018 17:22:23 GMT</pubDate>
            <atom:updated>2022-11-03T16:08:05.787Z</atom:updated>
            <content:encoded><![CDATA[<p>Large Scale Web Apps Memory Management</p><h3>Introduction:</h3><p>Performance tuning for large-scale web apps is a sophisticated problem, a bunch of factors plays important and different roles in this problem, in this article we will talk about a very specific case of performance tuning which is optimizing memory usage</p><h3><strong>What Is Large Scale App First?</strong></h3><p>There is no specific definition for large-scale applications as it is a relative term. Referring to Stanford university&#39;s definition, “It is 1000x anything previously built “</p><p>Usually, a large-scale app is a web application that uses a lot of web servers, Database servers, and Memcache, also it relies on a virtualization layer that has a load balancer to direct TCP connections to suitable web servers and also it may be using content delivery network for static content.”</p><h3><strong>So what Is This Article About?</strong></h3><p>In this article we will be discussing a very specific concept to optimize your large-scale web application, we will talk about <strong>h<em>ow to optimize memory usage to reduce the amount of physical instances needed to serve the massive amount of requests coming to your servers</em>. </strong>We will not be talking about memory management in general, but we will be discussing optimizing Heap usage. If you are interested to know more about what is Heap read the next section, otherwise skip it.</p><h3>What Is Heap?</h3><p>A large pool of memory consists of locating a block of unused memory of sufficient size in a random frequently accessible manner (dynamic allocation,) and is used to satisfy an allocation request. Simply, if you instantiate an object, its values will be stored in Heap.</p><h3>What May Cause a Memory Leak For Large Scale Web Apps?</h3><p>For large-scale web apps, a common memory leak happens due to anonymous objects, objects with no references, a lot of developers think that automatic garbage collection completely frees them from worrying about memory management; unfortunately, this is not true, especially in large-scale apps.</p><h3>What Is Garbage Collection And How Does It Works?</h3><p>Garbage Collection is tracking down all the objects that are still used and marks the rest as garbage. It does something called reference counting to count objects that have references.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*rcI78yr_aL1bxwzN" /></figure><p><em>Look at the figure above, green clouds are objects in use, blue objects live in RAM, and the number inside the circle denotes their reference counts. Meaning, we can simply delete all gray objects, since they either have no references or are referenced by anonymous objects</em></p><p><em>When there is a downside for this approach, look at this figure!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*84qkNdkuwFmr6wwS" /></figure><p>We may end up with detached cycles which will cause a memory leak. There are many solutions to this problem, and there are many implementation methods in different languages, such as mark and sweep implementation in Java.</p><p>Another thing that we should explain before going to our tips for optimization is Memory Pools.</p><h3>What are memory pools?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*y5V4_6195lKrMk-g" /></figure><p>Simply speaking it is dividing the heap into 5 segments ( sometimes 4) to improve dynamic memory allocation somehow ( we will explain how).</p><ul><li>Eden: the region in memory where the objects are typically allocated when they are created. As there are typically multiple threads creating a lot of objects simultaneously, Eden is further divided into one or more Thread Local Allocation Buffer</li><li>Survivor Spaces: we will not talk about it in deep but simply when young generation objects collected from Eden they are copied to one of the 2 survivor spaces and will be moved repeatedly between the two survivor spaces until they exceed a predefined threshold for the number of cycles ( don’t worry if you didn’t understand how do survivor spaces exactly work).</li></ul><p>When objects references are being counted ( for Minor or full garbage collection) it will cause stop-the-world, every thread except for the threads needed for the GC(Garbage Collection) will stop their tasks ( Important note here: if you googled stop the world you will find a lot of myths about it and you find wrong answers marked as correct on stack overflow website)</p><ul><li>Old generation: if a young object promoted to be an old one ( after living in Survivor for a specific threshold of cycles called tenuring threshold) it will be assumed to live for a long time, but you may ask yourself where did we get this assumption from? Let us take a look at what some researchers found</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*SYmMC4prQHU5DfWW" /></figure><p>You will notice from the graph that if the object promoted to be an old object then it will live for a long time ( Note that this is just based on previous data and it may not be the case for your project so you have to understand your operating environment )</p><ul><li>Permanent generation: we will not talk about this part since it is outside the scope of this article</li></ul><p>Before going throw an example of optimization let us talk about our KPIs</p><h3>What are your key performance indicators?</h3><p>There is a lot of KPIs to care about but finally, it depends on you and your application, let us go throw some examples:</p><ul><li>If you care about Max pause time which may cause connection time out for your service clients ( this will happen if you serve a huge amount of requests and some of them exceed the connection or read timeout due to stop the world problem) then you have done some actions to avoid that, we will talk about that later</li><li>If you care about the amount of memory reserved for the Heap then you will expect more frequent GCs but less Memory usage</li><li>If you care about the cumulative pause time and the amount of work done then you have to do some actions related to all GC causes, we will talk more about this later.</li><li>You may also care about the number of threads used for garbage collection</li></ul><p>Let us take the first example and figure out how to improve the performance (note that this example is talking about Java application case but the concepts here can be applied to most programming languages) :</p><p>If you have a system that is written in Java ( enterprise system) and you want to serve as many as possible clients within a small amount of time then let us discuss what you should do</p><p>1. If you are using G1 garbage collection system which is the default for Java 9 and later Do not Set Young Generation Size, if you did JVM will not respect max pause time factor even if you specify it, JVM will make its best effort to achieve max pause time goal but probably it will not due to the limitations you set and this will cause a considerable amount of latency</p><p>2. Make sure to use constants as you can and also static fields since this will reduce the amount of allocated data and due to that will reduce GC frequency</p><p>3. You can also use multi-threaded garbage collection by specifying needed flags for JVM when you run your application</p><p>4. Understand the behavior of your application and due to that optimize the tenuring threshold to fit your needs ( we will talk later on how to understand you app behavior)</p><p>There are a lot of other factors to take care of if you are really looking for a professional solution</p><p>If you care about the amount of memory allocated for the heap and you don’t have data yet to decide the needed capacity you can use previous research data and use dynamic allocation with approximate max and min sizes</p><h3>How to understand your application behavior?</h3><p>There are a lot of tools to monitor your application but for our case, I want to recommend using MicroMeter with Prometheus which will provide you default metrics for GC, but if it doesn’t fit with your needs you can create your own library and plug it into Prometheus and micrometer, also you may use Grafana to visualize data in real-time, but there is an easier way to do that, you can specify log level for G1GC to finest and take these logs and upload it manually to a website called GCEasy which will analyze them and make it easier for you to understand your application, also you can use their API to send data periodically and it will save all the reports for you</p><h3>Simple tricks to avoid massive problems</h3><ol><li>Use immutability wisely: if you read a book talking about object-oriented design it will tell you that immutability is absolutely great thing, but this is not the case all the time, for large apps this may cause a high allocation rate if you keep re-structure objects for each change, for example, Strings are immutable in java so don’t use concatenation operator too much since it will create a new object each time and this leads to a higher GC frequency but there is a great advantage for immutability too, suppose that we have a container object with a lot of objects inside it if the container object is created then all the sub-objects must be created before, so now you can guarantee that the container object is at least as young as the youngest reference it holds, this means that when performing garbage collection cycles on young generations, the GC can skip all sub-object if the container is promoted to be an old object</li><li>Avoid using unbounded objects: simply do your best to predict sizes, for example, avoid using ArrayLists with on specific size in java as much as you can since each time you modify its content it will check the availability and if there is a problem it will reallocate the whole object, which will increase the allocation rate, another example, if you are using python lists for a set of numbers, use Numpy array instead since python lists are very generic and will cause high allocation rate and also will lead to a higher GC frequency</li><li>Be careful when you are dealing with files: if you are handling files on the server side try to deal with them as a stream of bytes then deserialize them directly</li><li>Use primitive values as much as you can since they will not produce garbage</li></ol><h3>More advanced stuff</h3><ol><li>High allocation rate: allocation rate is measured in the amount of memory allocated per time unit. You can measure it by analyzing G1 logs, allocation rate will significantly affect GC frequency, you should notice that the allocation rate might and probably does not directly correlate with the actual throughput of your application. We already talked about some simple tricks to reduce it but now let us talk about how to reduce its impact, simply increasing Eden size may reduce the impact and reduce the frequency but it may cause a longer pause time, so it is a trade-off and it is up to you what you should care about</li><li>Promotion rate and premature promotion: promotion rate is measured in the amount of data propagated from the young generation to the old generation per time unit, as discussed before if an object exceeds a specific threshold it will be promoted, if something went wrong then some objects will be promoted but they have a short life expectancy, the problem is they will not be collected within young collection, so for those objects to be cleaned a major GC must be triggered. You can calculate promotion rate by analyzing GC logs and this will help you to understand the behavior of your application, after understanding the behavior it is your mission to decide the best size for young GCs and maybe specify tenuring threshold.</li></ol><h3>Conclusion:</h3><p>Managing large-scale apps is not an easy task, there are a lot of factors to care about and you may have probably noticed that we are talking about very specific cases, so we&#39;re just talking about a small part of memory usage enhancement. So the aim of this article is to raise awareness of this problem since most developers ignore garbage collection enhancement and they think that it is already completely managed for them.</p><h3>References:</h3><p>Oracle official documentation</p><p>Plumbr hand book</p><p>OverOps</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6dc06237836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extract Main Objects from Images Automatically with Image Processing]]></title>
            <link>https://medium.com/@kareemayesh/extract-logo-from-image-with-image-processing-tutorial-751f1d1c34cb?source=rss-1392d12b4e43------2</link>
            <guid isPermaLink="false">https://medium.com/p/751f1d1c34cb</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Kareem Ayesh]]></dc:creator>
            <pubDate>Tue, 23 Jan 2018 19:45:39 GMT</pubDate>
            <atom:updated>2022-03-27T06:52:05.027Z</atom:updated>
            <content:encoded><![CDATA[<h3>introduction</h3><p>If you tried to learn image processing before reading this article, then I am sure that you have seen a lot of complicated articles, tons of books with sophisticated terms and a lot of videos telling you that you know nothing about image processing!</p><p>concepts are made to seem more complex than they actually are!, so in this article I want to simplify it as much as i can for you</p><h3>What is image processing</h3><p>Simply, any form of processing for which the input is an image and the output is an image or anything else.<a href="https://en.wikipedia.org/wiki/Digital_image_processing"> Reference</a></p><p>If I asked you to re-scale an image then I am asking you to do some image processing!!</p><h3>What do we want to do in this example?</h3><p>We want to create a simple image processor that is capable of extracting logos from any image automatically (instead of doing it manually using photoshop or any other tool)</p><h3>How we will do that?</h3><p>Before discussing the methodology that we are going to use, let us discuss the nature of digital image before manipulating it, digital image is constructed from 2 dimensional matrix, for simplicity think of each element in the matrix as a pixel (Raster Images)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LD4XOF-VANdwJnToiWr-Ww.png" /></figure><p>According to that this emoji is a collection of pixels stored in a matrix</p><p>But how do we give the pixel it’s color and how do we represent it ?</p><p>You already know from school that you can get most colors by mixing Red , greed and blue , so we will use this idea in our representation of pixel color , the best way to do that is by storing them into a vector</p><p>[R,G,B ] which has the concentration of each color with a value from 0 to 255 ,, this what jpg format actually look like !</p><p>After understanding the nature of jpg images let us think of how can we cut off the important part of the image</p><p>Did you ask yourself before how do you recognize objects (logos in our example) and separate them from the background? simply using contrast concept</p><p>If the object has the same color as the background then you will not be able to distinguish it from the background, and this actually what some animals do to hide itself, so according to that I will use this recipe to recognize objects</p><p>Our mission is to calculate the difference between the color of a pixel from background and any other pixel color to determine if it is from the background or not, I want to assume that the first pixel in any image (which is the pixel on the upper left corner) is from the background , notice that this assumption is correct for most images or let us say it is approximately correct for all images !</p><p>What do we need to accomplish our goal?</p><p>Any programming language, I will choose python because it is my favorite, also it is the most common language in this field.</p><p>To make our calculations easier, I will use numpy package which is available to download using pip (python package manager)</p><p>Simply download it by typing this in your terminal or cmd :</p><pre>pip install numpy</pre><p>If you are ready, let us keep going!</p><h3>Let us do it?</h3><p>before start coding notice that all the code will be available at <a href="https://github.com/kareemsuhail/extract-logos-from-images-with-numpy">GitHub</a></p><pre>## import numpy as np is a convention</pre><pre>import numpy as np</pre><pre>## we need matplotlib just to read and show data</pre><pre>from matplotlib import pyplot as plt</pre><pre>from math import sqrt</pre><pre>&#39;&#39;&#39;</pre><pre>defining cut off function which takes 3 parameters :</pre><pre>1.image: which the image that we will draw over it ( image path as String)</pre><pre>2.mask : the image that we want to cut off ( image path as String)</pre><pre>3.power : which the percent for color difference ( float from 0 to 1)</pre><pre>note that the default value for power is 0.2</pre><pre>&#39;&#39;&#39;</pre><pre>def cutOff(image,mask,power=0.2):</pre><pre># reading both image and mask and converting them into numpy array</pre><pre>image_np = np.array(plt.imread(image))</pre><pre>mask_np  = np.array(plt.imread(mask))</pre><pre># note that the shape of these arrays will be :</pre><pre># ( image height,image width ,3)</pre><pre># note that 3 is constant since we are dealing with RGB image</pre><pre>mask_background = mask_np[1, 1]</pre><pre># this is our reference vector  which we will use to measure difference</pre><pre># according to it</pre><pre>start_row = image_np.shape[0] - mask_np.shape[0]</pre><pre>start_col = image_np.shape[1] - mask_np.shape[1]</pre><pre># this part is just to define where should we start printing our</pre><pre># mask over the original image ,, here we will use the right coroner as a start</pre><pre>#==============================================</pre><pre># now we want to iterate over each pixel and measure the difference</pre><pre># then we want to calculate the percentage of difference so it is easy for us</pre><pre># as humans to figure out if we need this pixel or not</pre><pre># as you see we will start iterating over the mask</pre><pre>for row in range(start_row, image_np.shape[0]):</pre><pre>for col in range(start_col, image_np.shape[1]):</pre><pre># reading pixel from mask</pre><pre>temp_RGB_vector = mask_np[row - start_row, col - start_col]</pre><pre># measuring distance</pre><pre>temp_distance = (np.sum(np.absolute(np.subtract(temp_RGB_vector.astype(np.int16), mask_background.astype(np.int16)))))</pre><pre># calculating percentage</pre><pre>percent = temp_distance / sqrt((255) ** 2 + (255) ** 2 + (255) ** 2)</pre><pre># if the percent is lower than desired power do not write this pixel over</pre><pre># original image</pre><pre>if percent &lt; power:</pre><pre>continue</pre><pre># if not write is</pre><pre>for color in range(3):</pre><pre>image_np[row, col, color] = mask_np[row - start_row, col - start_col, color]</pre><pre># Read the image from 3d numpy array it and show it</pre><pre>plt.imshow(image_np)</pre><pre>plt.show()</pre><pre># let us test our code</pre><pre>cutOff(&quot;captain-america.jpg&quot;,&quot;geeks.jpg&quot;,0.4)<br></pre><h3>Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*q4__JBBJOZWYUCeq8gqLMg.jpeg" /></figure><h3>Summarize what is going on?</h3><p>We have read the image that we want to cut off which geeks.jpge in the first test and stored it in 2d numpy array ,, then we have stored our reference point which is a pixel from background ,, iterating over the whole pixels in and measuring the difference and comparing it with our cut off power ,cut off power is just a number determines our threshold to classify pixels if it is from background or not ,, note that it’s varying between 0–1 , if the image contrast is low it will be closer to 0 , if not it will be closer to 1 , now it is your homework to calculate it automatically , or I will make in another article , if the pixel color is lower that or cut off power then it is from background and we don’t have to write it ,, notice again that I have written the image over another image which is captain America image ! to let you observe the result better .</p><h3>Conclusion:</h3><p>Image processing is not a concept from mars, it is easy just understand the idea behind it and understand how to manipulate images pixel level</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751f1d1c34cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>