<?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 Nir Tayeb on Medium]]></title>
        <description><![CDATA[Stories by Nir Tayeb on Medium]]></description>
        <link>https://medium.com/@nirtayeb?source=rss-6535621c20e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KhcsQ699fROFRoB1cpvXrw.jpeg</url>
            <title>Stories by Nir Tayeb on Medium</title>
            <link>https://medium.com/@nirtayeb?source=rss-6535621c20e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 12:57:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nirtayeb/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[Creative database denormalization techniques]]></title>
            <link>https://nirtayeb.medium.com/creative-database-denormalization-techniques-5652f9ae2075?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5652f9ae2075</guid>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 06:34:23 GMT</pubDate>
            <atom:updated>2024-08-04T20:32:44.349Z</atom:updated>
            <content:encoded><![CDATA[<p>In the early stages of application development, the data schema is typically designed with normalization as the guiding principle. However, as the application grows and tables expand, specific queries can become sluggish, negatively impacting the user experience. In such situations, it becomes essential to consider denormalizing the data.</p><h3>What is denormalization?</h3><p>Denormalization involves strategically duplicating a small amount of data across tables, reducing the need for joins that combine data from multiple sources. Another denormalization technique is maintaining precomputed data aggregations instead of calculating them in real time. While this approach introduces some data redundancy, it can significantly enhance query performance:</p><p>Some “textbook” examples:</p><ul><li><strong>The Classic Approach</strong>: Instead of joining the “orders” and “customers” tables, which might be large, to retrieve the customer name, we add the customer name as a column in the orders table.</li><li><strong>The “Justin Bieber” Case</strong>: In a social media app, rather than maintaining the relationship of “users liked a post” and then aggregating the count of likes for a post, we keep the current likes_count in the posts table. This approach is named the “Justin Bieber” case because Instagram used it to manage likes for celebrity posts.</li><li><strong>Short-Circuiting</strong>: In scenarios with three or more levels of joins, such as organization → users → categories → posts, to eliminate one or more join levels, we add organization_id and/or user_id directly to the posts table.</li></ul><h3>What are the drawbacks of denormalization?</h3><p>After denormalizing the data, new problems arise, including the need for extra storage space due to data duplication. When a value changes, all its copies in other tables must be updated to avoid anomalies and discrepancies. Updating all the copies of the data can lead to longer write operations.</p><p>These are classic textbook examples of denormalization. Databases have evolved, and we have new tools to maintain our basic data model.</p><h3>Materialized view</h3><p><strong>What is a materialized view?</strong></p><p>A materialized view is a database object that includes a copy of a query’s result. This way, we don’t need to fetch, process, and combine the data from all the tables involved in the query or aggregate and group the data repeatedly.</p><p>Examples (postgres syntax):</p><pre>CREATE MATERIALIZED VIEW MV_MY_VIEW<br>AS SELECT * FROM &lt;table_name&gt;;</pre><p><strong>The supported RDBMS are</strong> Oracle (&gt;8i), PostgreSQL (&gt;9.3, since 2013), SQL Server (&gt; 2000), DynamoDB, and BigQuery.</p><p>MySQL doesn’t support it out of the box.</p><p><strong>Stream processing frameworks:</strong> Apache Kafka (since v0.10.2), Apache Spark (since v2.0), Apache Flink, Kinetica DB, Materialize, and RisingWave all support materialized views on data streams.</p><p>The benefits of using materialized views:</p><ul><li>No need to change the DB schema</li><li>Faster data retrieval because it doesn’t re-calculate but stores the results</li><li>It’s possible to index the results.</li></ul><p>The cons of using materialized views:</p><ul><li>Usually, materialized views are not auto-refreshed, so data may not be fresh</li><li>Maintainance outside of the code</li><li>Requires more storage</li></ul><h3>Offload as a Document</h3><p>When I worked at Tapingo/GrubHub a few years ago, we aimed to decouple the ordering system from the central database. One reason, though not the primary one, was the frequent need to fetch related order data for various purposes, such as payments, POS display, ticket printing, Kitchen Display System, courier information, and order content.</p><p>We addressed this by creating a comprehensive document encapsulating all relevant data contexts and distributing it to various microservices. This document included duplicate data about shops and customers, which was accurate for the specific time. Each microservice had the autonomy to decide where and how long to store the document, allowing for fast query times by order-id, shop-id, and other indices.</p><p>The document could be stored in a cache like Redis or MongoDB or streamed/pushed to a message broker or stream processing system.</p><h3>Use Array/JSON columns</h3><p>At EasyTeam, we implemented a “take a break feature,” allowing admins to define which breaks are available during a shift, which the worker then clocks in for.</p><p>A simple approach would be to create a many-to-many table between the scheduled shift and break types tables. However, since scheduled shifts are replicated frequently (new shifts every week), this would lead to an enormous many-to-many table. Instead, we used an array column on the scheduled shifts table to store the break types’ IDs, with a GIN index on the column for faster searches.</p><p>While this method may compromise data integrity, it significantly reduces the stored data.</p><p><em>From my experience, joining a table with a JSON field and selecting the JSON field in the query (either with</em> *or specifically) could hurt query performance.</p><p>In summary, denormalization helps fine-tune frequent heavy-read queries that lack performance. Use it wisely to avoid complex maintenance, extra storage costs, and data integrity.</p><p>This post was originally published in my newsletter, <a href="https://percentile99th.substack.com/">Percentile 99th</a>. If you wish to learn how to improve application performance, I will write about it extensively there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5652f9ae2075" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Database Optimizations Before Re-Architecting Your Backend]]></title>
            <link>https://nirtayeb.medium.com/dont-re-architecture-your-backend-before-you-read-this-ccf98146587e?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccf98146587e</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 08:24:27 GMT</pubDate>
            <atom:updated>2024-07-28T16:53:39.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZzFX3qonQgvi1X-FZKv4g.png" /></figure><p>Ensuring your applications run efficiently is essential. Before diving into complex solutions like caching, microservices, or rewriting code in different languages, it’s vital to solidify the fundamentals. By focusing on six key pillars, you can significantly boost your application’s performance, achieving up to an 80–90% improvement. Let’s explore these often overlooked foundational techniques that can dramatically enhance the performance of your database-driven applications.</p><p>Side note — I may refer to RDBMS and SQL in the post, but these principles apply to NoSQL systems and beyond.</p><p>Let’s deep dive,</p><h3>Database version</h3><p>New major versions are coming with new features and may include performance improvements. It is 200% right if we refer to PostgreSQL.</p><p>Benchmark made by <a href="https://www.enterprisedb.com/blog/performance-comparison-major-PostgreSQL-versions">EDB</a> shows a 47% performance enhancement between PostgreSQL v9.6 and v15 and a 10.4% upgrade from v12 to v15. V16 has as well some minor improvements. You can read more in this <a href="https://benchant.com/blog/postgresql-v16-performance">post by “benchant.com”</a>.</p><h3>Hardware</h3><p>The database is the heart of your application. If it doesn’t have enough computing resources, your whole application will be waiting for these resources to be available.</p><h3>CPU</h3><p><strong>For small-medium size</strong>, you need a minimum of 4 cores for parallelism of your workloads, connection concurrencies, and background jobs done by the DB (i.e., journaling). Scale up with these <strong>considerations in mind</strong>:</p><ol><li><strong>Workload Characteristics:</strong> CPU-intensive workloads (e.g., complex calculations and heavy transactions) require more cores for better performance.</li><li><strong>Concurrency:</strong> Higher numbers of concurrent connections and transactions can increase CPU requirements.</li><li><strong>Database Size and Complexity:</strong> Larger databases or those with complex schemas and queries may benefit from additional CPU resources to handle the increased processing demands.</li></ol><h3>Memory / RAM</h3><p>RAM impacts the database’s ability to cache data, work with indexes, and process queries efficiently, significantly affecting overall performance. <strong>For small-medium sizes </strong>require at least 4GB of RAM and scale up by these considerations:</p><ol><li><strong>Database Working Set Size:</strong> Ideally, your server should have enough RAM to hold the frequently accessed (“hot”) portion of your database (tables and indexes) in memory to reduce disk I/O.</li><li><strong>Connection Overhead:</strong> PostgreSQL uses a multi-process architecture, where each connection has its dedicated process. More connections imply more RAM for connection overhead. As a rough estimate, plan for about 10 MB (or more) per connection.</li><li><strong>Workload Type:</strong> Read-heavy workloads benefit from more RAM for caching, reducing read operations from disk. Write-heavy workloads may benefit less from caching but require sufficient RAM for sorting and transaction logs.</li></ol><h3>Storage</h3><p>The storage size varies from one application to another, but what is important here is the type of storage and its IO performance:</p><ul><li><strong>Storage Type:</strong> SSDs should be your choice</li><li><strong>Provisioned IOPS:</strong> Consider using provisioned IOPS storage for high-performance workloads to ensure consistent and fast disk I/O.</li><li><strong>Storage Auto-scaling:</strong> Enable auto-scaling for storage to adjust as your database grows automatically.</li></ul><blockquote><em>Scaling up your system cost usually more money. Monitor closely the use of your current resources and consider ways you decrease the use of the resources before adding more resources.</em></blockquote><h3>Network proximity / Geographics:</h3><p>It’s best to keep your database and application server as close to each other as possible, network-wise so that they can communicate more efficiently. One way to do this is by provisioning them in the same region on your cloud service and putting them within the same private virtual network. Also, it’s a good idea to use private IP addresses for communication between them rather than public IPs, which will help reduce the number of network hops and increase the speed of data transfer.</p><h3>Connections Management</h3><p>Opening a connection to the database is an expensive operation. It includes the DNS resolving, TCP handshake, TLS Handshake, authentication, and setting up internal resources such as session objects and watchdogs. So, you should be conscious about opening a connection to the DB and reusing them as much as possible.</p><p>The way to achieve it is by using <strong>connection pooling</strong>. It maintains a set number of connections and opens new ones until reaching a maximum value of connections. So, your application code should always have an open connection.</p><h3>Amount of queries in a single request/transaction</h3><p>Whether you use connection pooling or not, your database/pool has a limit on the maximum number of open connections. You should also verify the number of queries and their processing time so you won’t get to the point where your code is waiting for a connection to be available instead of running your business logic.</p><p>What should you look for?</p><ol><li>The N+1 problem</li><li>Filtering fetched data in code instead of in your queries</li><li>Aggregate fetched data in code instead of in a query (count/sum/averages/min/max/etc)</li><li>Fetch fields without using them (look up big text fields or tables with a lot of columns)</li><li>Use joins instead of multiple separate queries.</li></ol><h3>Optimize query processing time.</h3><p>Before we start to optimize, we need to understand the order of query execution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZVZ4gRQpU-5y7QVx.png" /></figure><p>In other words:</p><ol><li>Be careful joining too many tables.</li><li>Conditions and Grouping should be evaluated fast (JOIN, Where, Group by)</li><li>With less data, sorting will be faster and better if you store it in order.</li><li>The “Limit” doesn’t affect the performance of the query, just the amount of data transferred.</li></ol><blockquote><strong><em>Notes about JOINS</em></strong></blockquote><blockquote><em>Suppose you select from multiple tables using: </em><em>FROM table1, table2 WHERE table1.id=table2.other_id</em></blockquote><blockquote><em>You may have a cartesian product of table1 and table2 and only then filter it. Using the JOIN statement ensures it won’t happen: </em><em>FROM table1 INNER JOIN table2 ON table1.id=table2.other_id</em></blockquote><blockquote><em>Most ORMs will use JOINS properly if instructed to do eager loading.</em></blockquote><h3>Fine-tune condition evaluation with indexes</h3><h4>What are indexes</h4><p>Imagine you have a table of users containing ID, name, and birth date. Your app has a search function for all the users who have a Birthday today. Usually, the database will scan the table data row by row and filter all the records with this birthday. Imagine this table has 1M records.</p><p>Indexes are like a sidecar to your tables; they contain a “table of contents” in various data structures, so when you query data, it will be possible to access the records without scanning all table content. The index contains the data of one or more of your columns, but instead of using a list to hold the data, it uses other data structures like trees and a hash table and divides the column value into different parts so the search will be faster. full table scan is O(n), while index scan usually is O(Log(n)) or O(1), depends on the index.</p><p>So now, instead of scanning the entire table to find users with a birthday, it checks the index, gets pointers for the records in the table (or, more accurately, to the exact pages in the filesystem), and then retrieves the data.</p><h4>What should you index?</h4><p>The database evaluates first the conditions in the FROM Clause (if you have joined), then in the WHERE clause, and then in the GROUP BY. To tune up the speed of your queries, you should index every column in use in the JOIN clauses and then the common ground of your conditions in your WHERE clauses. Finally, the columns you group by.</p><p>One exception to remember is that the database won’t use an index with low cardinality, which means the data isn’t unique enough, i.e., a Boolean value or small Enums (gender, permissions, etc.)</p><h4>Types of indexes</h4><p><strong>Single column index</strong></p><p>The most classic index, which indexes the data based on one column</p><p><strong>Multi-column / Composite index</strong></p><p>It indexes the data based on the value of multiple columns in the order declared during creation. Creating an index on (A, B, C) will let you optimize queries with conditions like WHERE A=1 or WHERE A=1 and B=2 or WHERE A=1 and B=2 and C=2, but if it doesn’t include A, it won’t use the index, if it only includes A and C, but not B, it will use only the index with the value of A. Also, it could be more efficient for querying A=1 or B=2. For this kind of situation, it’s better to have two indexes, and the query engine will fetch all data with A and B using the indexes and evaluate the OR on the filtered data.</p><p><strong>Unique index</strong></p><p>Use this index to make sure the table doesn’t have duplicate data. The primary key is a unique index (behind the scenes). Querying using a Unique index is fast because finding one value within the index is fast, and then you get an exact pointer to the record containing the value.</p><p><strong>Partial index</strong></p><p>As the name suggests, it created the index on part of the data in the table. It solves the situation where you have a value to filter that is frequently in use and also for low cardinality columns. The filter definition includes a condition on the data to be indexed. For example,” index all birthdays of active users only.”</p><p><strong>Expression index</strong></p><p>Sometimes, there is a need to filter/group based on the result of a function. For example, to run a case-insensitive search, the condition will look like this:</p><p>WHERE lower(name)=lower(:input)</p><p>Using the lower function typically will not trigger the use of the index; hence, it will be a full table scan. If, for example, we want to find the number of users born in the same year :</p><p>SELECT year(birthday), count(*) FROM users GROUP BY year(birthday);</p><p>Databases make it possible to index the result of an expression, and then the query engine knows to use this index to execute the query.</p><p>CREATE INDEX users_lower_email ON users(lower(email));</p><h4>Index Data structures</h4><ul><li><strong>B-Tree </strong>— is the default data structure for indexes in most databases. The tree structure mathematically promises the worst-case scenario of O(Log(n)), and it is best for searching ranges of values.</li><li><strong>Hash</strong> hashes the column values and enables a lookup of O(1) when filtering for equality. But the query engine won’t use the index for range lookup (between, greater/smaller) or like statements.</li><li><strong>Gin</strong> (Postgres SQL) — is an “inverted index” appropriate for data values containing multiple component values, such as arrays, JSON, and strings.</li><li><strong>GiST</strong> (Postgres SQL) — Generalized Search Tree indexes are not a single kind of index but rather an infrastructure within which many different indexing strategies can be implemented. Use it usually for Geometry types, Text searches, Nearest neighbor searches, ranges of timestamps/IPs (using the correct data type)</li><li><strong>SP-Gist / Spatial</strong> — SP-GiST indexes are most valuable when your data has a natural clustering element and is not an equally balanced tree. A great example is phone numbers (at least US ones). They follow a format of 3 digits for the area code, 3 for the prefix, and 4 for the line number.</li><li><strong>BRIN</strong> — shorts for “Block Range INdexes” store summaries about the values stored in consecutive physical block ranges of a table. Thus, they are most effective for columns whose values are well-correlated with the physical order of the table rows — for example, time-series data such as audit logs or events.</li><li><strong>Fulltext</strong> — gather a column or multiple columns into a document, and then preprocess the document in various ways into an index, which makes it possible to run different kinds of text matches (including spelling mistakes).</li></ul><h4>What kind of index and data structure should you use?</h4><p>In most cases, the default of b-tree and single/multi-column value will be enough and give you the most you need. When it’s not enough, I would examine the data itself, which data types, the exact query, and the query plan using `Explain.` Then, We can create another index (and replace the old one).</p><blockquote><em>💡 pay attention that you should not index everything, as tempting as it is, because every index uses more storage and slows the write operations. Remember that the query planner usually uses the most selective index (fetching the smallest data), so some indexes may never be used.</em></blockquote><h3>Fine-tune data fetching with Partitioning</h3><p>If you deal with big data and need more than indexing, partitioning the data will let you only query the relevant portion. For example, if partitioning the data by “Year,” you will query only data from 2024, and all 2023 won’t be retrieved from the storage if you haven’t explicitly asked for it (partition is like a different storage unit). If most of the queries are in filtering by 2024, it will dramatically enhance your query performance.</p><p>Partitioning has overhead in maintenance, and it can lead to a spike in lock manager waits and negatively impact user query performance. Increasing smaller tables and multiple indexes and partitions can generate many locks per query, causing contention problems.</p><p>Based on my experience, focusing on these 6 pillars can significantly enhance the performance of the application by 80–90%, even before implementing any additional solutions such as caching, rewriting specific parts of the application in more performant languages, dividing into microservices, or using NoSQL.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccf98146587e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What R&D leaders should learn from CrowdStrike global outage]]></title>
            <link>https://nirtayeb.medium.com/what-you-should-learn-from-crowdstrike-outage-as-a-software-engineer-6f99e1bb6afb?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f99e1bb6afb</guid>
            <category><![CDATA[crowdstrike-outage]]></category>
            <category><![CDATA[crowdstrike]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 11:35:44 GMT</pubDate>
            <atom:updated>2024-07-23T05:57:33.467Z</atom:updated>
            <content:encoded><![CDATA[<p>One key lesson from the CrowdStrike global outage is the inevitability of software errors. As engineers, one of our responsibilities is to detect these errors as early as possible and minimize their impact.</p><p>From the <a href="https://www.crowdstrike.com/blog/falcon-update-for-windows-hosts-technical-details/">technical investigation blog post</a>, the issue was on a configuration update for their sensor; the configuration included information on how to recognize new malware. The configuration triggered a flow that resulted in the classic “Null Pointer Exception,” which crashed the code at the kernel level, resulting in BSOD.</p><p>As opposed to all the jokes about the junior engineer deploying a new version to production on the weekend, the issue was adding a configuration to the current product version. They have done this thousands of times since they were established and probably have automation for the process.</p><p>So how could CrowdStrike avoid it?</p><ol><li>One strategy that could have helped CrowdStrike avoid the outage is gradual deployments and canary releases. They could have averted the issue by rolling out the update to a small percentage of users and verifying its performance in a production environment. It’s important to note that such a strategy should be segmented to clients, not Critical infrastructure like hospitals/airports/cloud environments. According to a report from Microsoft, the configuration file was deployed to 8.5 million users.</li></ol><p>2. Passing configuration files through CI pipelines for automated testing on different OS versions.</p><p>I want to believe that a company of this size has these kinds of CI pipelines, but it doesn’t sound like the issue was on one specific OS version that their automation didn’t cover.</p><p>3. Adding unit tests/integration tests in this area and even fuzzing it around. The sensor runs in the kernel space, a highly sensible area for errors which is If it was a user-space software, the OS would have terminated the program, but in the kernel, usually, there isn’t protection, and the system doesn’t load (I’m not a kernel developer)</p><p>4. Using Code Smells and static code analysis tools. Finding null pointers in CPP code is a classic error that these tools look for before the code hits production.</p><p>– –</p><p>If you are an R&amp;D leader, use these tools and strategies in your favor. Analyze your current solution’s failure mode and effects, understand the risks they pose to your clients, and plan your way into resiliency. If you want to learn how to do it, comment, and I will write another post about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f99e1bb6afb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 Ways You’re Using ORMs Wrong and How To Fix]]></title>
            <link>https://nirtayeb.medium.com/6-ways-youre-using-orms-wrong-and-how-to-fix-0828fb99f150?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/0828fb99f150</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Sun, 11 Feb 2024 23:11:47 GMT</pubDate>
            <atom:updated>2024-02-11T23:11:47.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iPm6H-OcDpvnZO3PmZ4kg.png" /></figure><p>We love ORMs because they simplify and streamline the working process with relational databases.</p><p>ORMs provide a higher level of abstraction, allowing us to work with objects and classes instead of raw SQL queries. They automate everyday database tasks such as CRUD operations, reducing the boilerplate code we need to write. ORMs handle database connections and transactions, making managing and scaling our applications easier. With ORMs, it’s possible to write database-agnostic code, quickly switch between different database systems, and focus more on application logic.</p><p>But with all the benefits and abstractions, it is easy to write poorly performant code.</p><p>For the examples, I’ll use the scheme from the <a href="https://www.prisma.io/docs/orm/prisma-schema/data-model/models">Prisma ORM documentation</a>, which describes a blogging platform with users, profile details, posts, and categories.</p><pre>datasource db {<br>  provider = &quot;postgresql&quot;<br>  url      = env(&quot;DATABASE_URL&quot;)<br>}</pre><pre>generator client {<br>  provider = &quot;prisma-client-js&quot;<br>}</pre><pre>model User {<br>  id      Int      @id @default(autoincrement())<br>  email   String   @unique<br>  name    String?<br>  role    Role     @default(USER)<br>  posts   Post[]<br>  profile Profile?<br>}</pre><pre>model Profile {<br>  id     Int    @id @default(autoincrement())<br>  bio    String<br>  user   User   @relation(fields: [userId], references: [id])<br>  userId Int    @unique<br>}</pre><pre>model Post {<br>  id         Int        @id @default(autoincrement())<br>  createdAt  DateTime   @default(now())<br>  updatedAt  DateTime   @updatedAt<br>  title      String<br>  published  Boolean    @default(false)<br>  author     User       @relation(fields: [authorId], references: [id])<br>  authorId   Int<br>  categories Category[]<br>}</pre><pre>model Category {<br>  id    Int    @id @default(autoincrement())<br>  name  String<br>  posts Post[]<br>}</pre><pre>enum Role {<br>  USER<br>  ADMIN<br>}</pre><h3>The n+1 problem</h3><h3>Fetching of data without using eager loading</h3><p>Assuming we want to list all user posts with a User role. A naive approach to writing the code is:</p><pre>async getUserPosts() {<br>	const users = await prisma.user.findMany({where: {role: prisma.Role.User}});<br>  return users.flatMap(user =&gt; user.posts);<br>}</pre><p>Behind the scenes, what is going to happen:</p><ol><li>Query the database for the user’s table for all the users with role admin:<br>SELECT * FROM users WHERE role=&#39;User&#39;</li><li>Then, For each record, query the database (again) for the user posts:<br>SELECT * FROM posts WHERE userid=&lt;X&gt;</li></ol><p>You won’t feel the performance issue when developing the application with a few test users. But once you get to hundreds or thousands of users in the production environment, this function will take “forever” from a user experience perspective. Every round trip to your DB takes at least 10ms, not including the query that needs to run and the data transfer between the databases and your server.</p><p>Using eager-loading, you will reach the database only once!</p><pre>async getUserPosts() {<br>	const users = await prisma.user.findMany({<br>		where: {role: prisma.Role.User}, <br>		include: {posts: true }<br>	});<br>	return users.flatMap(user =&gt; user.posts);<br>}</pre><p>By using include here, the ORM (prisma in my example) uses the SQL Join statement when constructing the SQL to query the data.</p><pre>SELECT * <br>FROM users<br>INNER JOIN posts ON users.id = posts.userid <br>WHERE role=&#39;User&#39;</pre><h3>Another variation of the n+1 problem</h3><p>Assuming we want to list all posts with their writer’s short bio, a naive approach will look like this:</p><pre>const posts = await prisma.posts.findMany();<br>const postsWithBio = posts.map((post: prisma.Post) =&gt; {<br>	return {<br>		title: post.title,<br>    publishedAt: post.publishedAt,<br>    authorBio: post.author.profile?.bio<br>});</pre><p>Again, the issue is that the code will make a round trip to the database for each post to query the author and the profile. The solution in this specific case is to use include twice, but if we have a more complex schema that uses more relations between the entities. We can implement another solution.</p><p>First, map all the unique author IDs, then fetch only the profiles (or bios) of these author IDs and map them.</p><pre>async function getPostWithBio(){<br>	const posts = await prisma.posts.findMany();<br>	const authorIds = posts.map((post: prisma.Post) =&gt; post.authorid);<br>	const profiles = await prisma.profiles.findMany({authorId: {in: authorIds}});<br>	const authorToBio = new Map(profiles.map(p =&gt; [p.userId, p.bio]));<br>	<br>	const postsWithBio = posts.map((post: prisma.Post) =&gt; {<br>		return {<br>			title: post.title,<br>	    publishedAt: post.publishedAt,<br>	    authorBio: authorToBio.get(post.authorId)<br>	});<br>}</pre><p>In this way, only two queries are going to the database.</p><pre>SELECT * FROM posts; <br>SELECT * FROM profiles where userid in (1,2,3,4,...);</pre><p>Remember that this is a straightforward use case; this issue is widespread in more complex systems and looks slightly different. Your code will iterate over one entity, then go into other classes and functions, which will fetch more data from the DB, creating the N+1 problem without you notice.</p><p><strong>How to identify the N+1 problem</strong></p><p>The best way to identify the N+1 issue in your system is by monitoring your app in three different ways:</p><ol><li>Turning on your debug/info log and configure your ORM to log the SQL queries it generates.</li><li>Watch the database query log and look for frequent and similar queries fetching by one ID.</li><li>Using an Application Performance Monitoring (APM) system such as NewRelic, Sentry, and Azure Application Insight — they visualize all the calls to the DB on each request/transaction and show you how long it took and how long each request spent communicating with the DB.</li></ol><h3>Querying without using indexes</h3><h3>No defining Index</h3><p>Assuming we need to search for posts by title, a naive implementation will look like this:</p><pre>const posts = await prisma.posts.findMany({title: query});</pre><p>If we look in the schema, we won’t see an index definition on the title field. We won’t see any index explicitly defined in our schema (except primary keys/foreign keys relations/unique). Why? Because it’s not intuitive for object-oriented/functional programmers to think about data indexing.</p><p>Running the code above will result in a full table scan to look up the query. As the name suggests, a full table scan means an O(N) lookup for the data. Running the query will take a lot of time and resources if we have thousands of posts and more properties on each post.</p><p>If we set an index (of the default “b-tree” type) on the field, the lookup time will usually decrease to O(Log-N).</p><pre>model Post {<br>  id         Int        @id @default(autoincrement())<br>  createdAt  DateTime   @default(now())<br>  updatedAt  DateTime   @updatedAt<br>  title      String<br>  published  Boolean    @default(false)<br>  author     User       @relation(fields: [authorId], references: [id])<br>  authorId   Int<br>  categories Category[]<br>  @@index([title])<br>}</pre><blockquote><em>💡 Suppose you don’t use the query frequently. Instead of defining an index on the title field, you can add conditions to the query using other indexes. Then, the search will be on a subset of the data instead of having a full table scan.</em></blockquote><blockquote><em>💡 Remember that the cost of indexing the data is a lower write performance. So, depending on your use case, decide which index is necessary and which is nice if writing performance matters to you.</em></blockquote><h3>The query cannot use the index (wrong index type)</h3><p>Assuming we want to query posts by a string found in the title.</p><pre>const posts = await prisma.posts.findMany({title: {contains:&quot;query&quot;}});</pre><p>This code results in a query including the “LIKE” operator:</p><pre>SELECT * FROM posts WHERE title LIKE &#39;%query%&#39;;</pre><p>The default index algorithm is B-Tree, and leading ‘%’ cannot be queried using the index.</p><p>The solution is to define another type of index to query the data efficiently; in this case, it’s GIN or GiST (on PostgreSQL)</p><pre>@@index([title], type: GIN)</pre><p>For further reading, I suggest reading <a href="https://alexklibisz.com/2022/02/18/optimizing-postgres-trigram-search">this fantastic blog post</a> explaining how trigram-based operations and indexes improve query performance by several orders of magnitude.</p><h3>Using model objects as output</h3><p>Assuming we need to implement an endpoint to fetch all users, a naive approach will look like this.</p><pre>@Controller(&#39;users&#39;)<br>export class UsersController{<br>  @Get()<br>  findAll(): prisma.User {<br>    return await prisma.users.findMany({});<br>  }<br>}</pre><p>When nest.js and other frameworks evaluate objects, they transform the object entirely to JSON, iterating all over the properties and sub-properties. Using the model as the output will result in lazy loading of each user’s relations, meaning more queries to the DB and more unnecessary data returned with the requests. It can also lead to a security risk of exposing private or confidential information.</p><p>Instead, you should clearly define the interface to use. With typescript, it’s possible to use Pick&lt;T&gt; to define a partial of another type to pick only a subset of the properties or Omit&lt;T&gt; to exclude some properties.</p><h3>Query unnecessary data</h3><p>Assuming we want to query all posts and print only their dates and titles:</p><pre>const posts = await prisma.posts.findMany({});<br>for (const post of posts) {<br>   console.log(post.title, post.publishedAt);<br>}</pre><p>This code ends up with this SQL query:</p><pre>SELECT * FROM posts;</pre><p>It looks simple, but if we have even 1000 posts and their content each is 10KB of words, we transfer at least 10MB of data without even using it. Instead, we should select only the fields we need.</p><pre>const posts = await prisma.posts.findMany({select: [&#39;title&#39;, &#39;publishedAt&#39;]});<br>for (const post of posts) {<br>   console.log(post.title, post.publishedAt);<br>}</pre><p>Which will end up with a query like:</p><pre>SELECT title, publishedAt FROM posts;</pre><p>In summary, using ORM is excellent for productivity but not always suitable for performance. Understanding what is happening behind the scenes is crucial to ensure optimal code performance.</p><p>If you enjoyed the article, please forward and share it with your teammates/acquaintances and help them avoid these mistakes.</p><p>This post was originally published in my newsletter “<a href="https://percentile99th.substack.com/p/6-ways-youre-using-orms-wrong-and">Percentile 99th</a>”. My subscribers get all the information first; in the future, exclusive content will be shared only over the newsletter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0828fb99f150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you should avoid the 99th Percentile for your users]]></title>
            <link>https://nirtayeb.medium.com/percentile-99th-4a91f7471299?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a91f7471299</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 20:15:58 GMT</pubDate>
            <atom:updated>2024-02-05T21:54:26.059Z</atom:updated>
            <content:encoded><![CDATA[<p>The 99th percentile is the highest percentile you can get. It means you are among the top scorers since you scored higher than 99% of the group who took the test. Only 1 in 100 the group scores in this range, so it places you at the very top of the pool.</p><p>Most of us want to be in the 1% percent that scored the highest. We want to be the top earners, performers, the fastest, the fittest, and generally the best in our crafts.</p><p>However, in application performance metrics, the users in the 99th percentile have the highest latency score (or response time, first contentfull paint, etc.…). Therefore, they had the <strong>worst experience in the measured period.</strong></p><h3>Why should you care?</h3><p>You probably think, okay, it’s only 1% who experience some shitty performance. Why should I care about these 1% of users?</p><ul><li>The 1% percent could happen where your system doesn’t scale, for example, when working on too much data — which usually occurs for the top clients.</li><li>The 1% can be the edge cases when one user’s action might affect other users’ experience when the system runs on shared resources.</li><li>The 1% percent could lead your way through capacity planning. By analyzing this metric, you can determine the level of infrastructure, compute power, or database capacity needed to handle the occasional high-latency requests without sacrificing overall performance.</li><li>Outliers can skew the mean score. Removing them can give a more accurate representation of the average user experience.</li></ul><p>Monitoring this metric is only the first step; the next step is finding the root cause of the score and fixing it for good. But it is only sometimes straightforward.</p><p>In my newsletter, <a href="https://percentile99th.substack.com/">“Percentile 99th</a>,” I cover the principles and how-tos every other week and deep dive into analyses of different technologies, including real-life examples from my experience and top companies.</p><p>To help you decrease the percentile 99th metric and help you become the top 1% percent of engineers who know how to improve the system to work like magic (and design new systems better), a real performance speedster.</p><figure><img alt="Performance Speedster winning the percentile 99th" src="https://cdn-images-1.medium.com/max/1024/1*FqEx_P95Opif_63hPZy0Fw.jpeg" /></figure><p>I welcome you to <a href="https://percentile99th.substack.com/">subscribe to Percentile 99th</a> .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a91f7471299" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How did I develop emotional intelligence?]]></title>
            <link>https://nirtayeb.medium.com/how-did-i-develop-emotional-intelligence-afe14b6e4e80?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/afe14b6e4e80</guid>
            <category><![CDATA[resilience]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <category><![CDATA[self-awareness]]></category>
            <category><![CDATA[relationships]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Wed, 16 Dec 2020 20:50:43 GMT</pubDate>
            <atom:updated>2020-12-16T20:50:43.776Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXnVPGL6zjscPmNyXbsWTw.jpeg" /><figcaption>there are more emotions that these guys… (Credits to Inside out Movie by Disney/Pixar)</figcaption></figure><p>The first time I heard about Emotional Intelligence was in my high-school. My teacher criticized the whole class for not having EQ at all, and it was true; we were entitled and smartasses (“gifted class”). I didn’t understand it that much back in the days, and unluckily, she didn’t teach us enough about it.</p><p>During my army service, I began to read books by Dan Arieli &amp; Sr. Ken Robinson, and they opened my mind to Psychology. My friend Tom, a great guy, introduced me to meditation, and since then, with years of practice and self-awareness, I became more and more emotionally intelligent. And, of course, I still have more to practice.</p><p>EQ helped me the most to advance as a leader. <strong>But why it took me years to develop it?</strong></p><p>First, to develop emotional intelligence, I had to develop higher self-awareness: self-awareness of my emotions, actions, and habits.</p><p><strong>Developing self-awareness takes a lot of time and effort</strong>:</p><ol><li>Meditation practice takes a long-time until it helps in realtime.</li><li>Journaling requires time, dedication, and it takes a long time to see patterns and results.</li><li>I had to learn and practice how to reflect well (Bayron Katie, anyone?).</li></ol><p><strong>I didn’t receive many good feedbacks</strong>:</p><ol><li>Mentors/Coaches/Courses are not there in a real-life situation.</li><li>Most of the feedback I get was by “failing hard,” either I didn’t achieve my objectives or something blew up in my face (i.e., conflicts)</li><li>Not all feedbacks were accurate or given constructively.</li></ol><p><strong>Self-awareness is the key, but it’s not enough</strong>. Learning a new way of thinking or acting and practice it without falling back to an old habit also takes time and effort:</p><ol><li>I had to find “safe spaces” to practice new habits deliberately.</li><li>Meditation helped me to create a space between the trigger and how I respond, which enabled me to choose to act differently once I was aware of a trigger in real-time.</li></ol><p>That is my take on EQ so far.</p><p>What about you?<br>Is EQ a priority for you?<br>How did you manage to develop it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afe14b6e4e80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Constraints make us creative]]></title>
            <link>https://nirtayeb.medium.com/constraints-make-us-creative-24d546dc4795?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/24d546dc4795</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[meditation]]></category>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[solutions]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Wed, 05 Aug 2020 13:50:15 GMT</pubDate>
            <atom:updated>2020-08-09T19:04:35.068Z</atom:updated>
            <content:encoded><![CDATA[<h4>We all have constraints, especially today, which required us to become more creative. Here is a story from my last weekend to inspire that creativity in you, even a bit.</h4><p>This weekend I was a staff at a self-awareness workshop near Caesarea’s beach (Sdot Yam, Israel). About 50 people of our self-awareness community joined the weekend. What usually we arrange in a big air-conditioned space altogether. We had to operate in the open air due to COVID-19, in the Israeli summer, in capsules of 20 people each. How did we handled the situation?</p><p>We asked our host to set a shade in the big balcony in advance. But the host set the shade only on a small part and didn’t cover enough space.</p><p>We also found out that there isn’t going to be a light in the balcony during the night.</p><p><strong>How did we handle this situation? How did we keep our community’s togetherness when we cannot have more than 20 people in one place?</strong></p><p>First, we calculated where the shade is going to be during our activities.</p><p>Then, we created three spaces separated with lycra and connected it to different secure fences so the wind won’t take it away. That’s how we could be together in one area and see each other but physically divided into capsules.</p><p>At the beginning of the activities, we switched people between the spaces to make sure they don’t stick with the people they know well, and that’s how we helped to strengthen the connection between people in our community and let them know better other people.</p><p>During the breaks, we deny entrance to the room, but only for water/coffee and toilets, and closed off the air-conditioners to ensure there aren’t gathering in close spaces.</p><p>In the evening, we attached battery-based led lights to the lycra, which also made a magical atmosphere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*qDvwvo0G_roT1uw5pu8fEQ.jpeg" /><figcaption>Our creative solution!</figcaption></figure><p><strong>One of my takeaways from this weekend was that most things are possible, and by thinking through the constraints, creative solutions will come.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24d546dc4795" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4×4 Trip to Jordan — Day #1 Eilat -> Aqaba]]></title>
            <link>https://nirtayeb.medium.com/4-4-trip-to-jordan-day-1-eilat-aqaba-8d63dd512a62?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d63dd512a62</guid>
            <category><![CDATA[offroad]]></category>
            <category><![CDATA[aqaba]]></category>
            <category><![CDATA[eilat]]></category>
            <category><![CDATA[journal]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Sat, 23 Feb 2019 20:34:38 GMT</pubDate>
            <atom:updated>2019-02-23T22:05:29.859Z</atom:updated>
            <content:encoded><![CDATA[<h3>4×4 Trip to Jordan — Day #1 Eilat -&gt; Aqaba</h3><p>I dreamed a lot of time to cross the border and travel to Jordan, But never thought it is going to be that way!</p><p>My friend Amichay had mentioned for a long time that he is going to a 4×4 trip in Jordan with an Israeli group using his own Jimny. But only until two weeks before the trip I asked him about the details and how I could join. He didn’t have a place in his car, but we realized that I can partake in the stuff car! In the same moment, I called the guide and reserved my spot!</p><p>We were a group of 4 cars, and we met near Kibbutz Eilot just before Eilat. We introduced each other for the first time and went quickly to the border to pass to the other side.</p><p>On the border, we had to pay a fee and change our car licenses to Jordanian one. We bought some alcohol in the Duty-Free store and passed the border. On the Jordanian Side, we met our local guide Abdullah which is a close friend of our tour guide and also a fascinating man, a Bedouin that born in the caves of Petra and also knows to speak Hebrew very well (and other languages), more about him later.</p><p>Also, a Jordanian Policeman joined the group, this is the law for groups. Unfortunately, he didn’t speak English, and most of us didn’t speak Arabic (including me), so we couldn’t communicate with him that much and get to know him. Which is a shame, probably could tell delightful stories about living in Jordan and about serving the king.</p><p>After finishing all the border control bureaucracy, we finally arrived at Aqaba!</p><p>In Aqaba, we toured the local market, where we could buy Sweets, Herbs, Tea, Coffee, Keffiyeh and different velvets and fabrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*7o-Ti200LHsx9Jkw" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*TDCqprUoUPw14dTI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*F22v_9UgG4GPz2b6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*jj128vj8V8oSACAD" /><figcaption>Boiling Coffee in the sand</figcaption></figure><p>After finishing the tour, Amichay, Alex and I went by ourselves in the city. We saw all the lucrative hotels of Aqaba — which are enormous, they look likes palaces, and one day I will definitely try them!</p><p>I think the most special part of the day was to look at Eilat from the other side for the first time. The Red Sea was also super quiet and clear and made us wanting to scuba dive here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*7PFiM22CuFhniXYU" /></figure><p>We finished our day with a nice glass of the Whisky we bought on the Duty-Free.</p><p><em>Originally published at </em><a href="https://senortraveler.com/2019/02/23/4x4-trip-to-jordan-day-1-eilat-aqaba/"><em>senortraveler.com</em></a><em> on February 23, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d63dd512a62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How you should not plan a trip to the Dead Sea & Jerusalem]]></title>
            <link>https://nirtayeb.medium.com/how-you-should-not-plan-a-trip-in-israel-54e996177d67?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/54e996177d67</guid>
            <category><![CDATA[jerusalem]]></category>
            <category><![CDATA[traveling]]></category>
            <category><![CDATA[israel]]></category>
            <category><![CDATA[travel-tips]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Fri, 01 Jun 2018 09:46:01 GMT</pubDate>
            <atom:updated>2018-06-01T10:13:19.425Z</atom:updated>
            <content:encoded><![CDATA[<p>Some weeks ago, Ran, my good friend, asked me to come with him to take photos of the Dead Sea at sunrise. Of course, I said yes, and we asked our girlfriends to go with us and enjoy a lovely weekend. We planned to make a Shabbat dinner at my apartment in Tel-Aviv, then drive to Ein-Bokek beach at the Dead Sea, build tents, wake up for sunrise and continue on to Qumran National Park and Ein Prat National Park.</p><p>What can go wrong?!</p><h3>Time…</h3><p>We haven’t been strict on the times, and neither me, Ran nor our girlfriends took the responsibility and the lead. Dinner set to 8:00PM but only began at 9:00PM, once we finished the meal we were spending time watching together some comedians on YouTube and a full-length movie — which was entertaining but made us leave Tel-Aviv only at 1:30AM !!! We arrived in the north of the Dead Sea only at 2:15 AM, then we took a break for 30 minutes because of complete tiredness, then we had to continue driving to Ein-Bokek before we finally arrived at 3:45AM. We took a nap until 4:45AM and began to set all our photography equipment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpC2mBN9_zJaRyjTEfpiHQ.jpeg" /></figure><h3>The Heat…</h3><p>The Dead Sea is the lowest place on Earth, but it is also one of the areas with the highest temperature in Israel. Even before the sunrise, the weather was warm, once the sun comes up, it got even worse. We couldn’t rest outside, and sleeping in my Seat Ibiza wasn’t comfort at all.</p><p>After sleeping a bit, we discussed what to do: we were too tired to walk a trail, the archeological site of Qumran National Park is fully exposed to the sun, and therefore is not suitable for a hot day like that. We thought about taking a spa day in one of the hotels, but we had to book it ahead, so we couldn’t. Eventually, we decided to stick to the original plan and go to Ein Prat National Park which contains a very short and easy trail to a Natural Spring, which found to be the BEST DECISION OF THE WEEKEND !!</p><p>The place was the oasis we needed to rest, get energized and cool our bodies from the heat with cold water pools.</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/BjUjiDVjX3B/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252F01bd62b31e309ec49710ce0e713119d0%252F5BA5D499%252Ft51.2885-15%252Fs640x640%252Fsh0.08%252Fe35%252F32514505_262415110991283_3097233343872237568_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d31c8493b20eaf77511d7397b44ef3e/href">https://medium.com/media/2d31c8493b20eaf77511d7397b44ef3e/href</a></iframe><h3>Lunch…</h3><p>I live in Tel-Aviv, most of the restaurants are open on Saturday. Unfortunately, this is not the same for the rest of Israel, especially not in Jerusalem.</p><p>We didn’t plan where to go eat afterward, we drove to Jerusalem, to Ein Kerem, AKA the only quarter with open restaurants in Jerusalem. But most of the restaurants were too expensive for us (students…) We looked on google and found out that “Ivo” (American Dinner) is open.</p><p>It costs us with a lot of frustration until we found a place to eat, and it didn’t go well with every one of us being exhausted and tired.</p><h4>Overall,</h4><p>We had a lot of fun during the weekend, everyone helped each other either by being a good wing-driving, driving while other slept, preparing breakfast while someone else was sleeping in the car (me..) or just go with the flow. I’m very grateful that I have friends like that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O60KkqMWmdOfgRFvpYjLcQ.jpeg" /></figure><p>Comment for any question,<br>Clap and follow to show appreciation,</p><p>Come and join my adventures all around the globe! Follow me on social media for more travel tips about Israel. I’m very enthusiastic about helping everyone to enjoy my beautiful country.</p><p><a href="https://www.youtube.com/channel/UCXAm4j2uLwijFeBAURox79w">YouTube</a> |<a href="https://www.instagram.com/senortraveler/"> Instagram</a> |<a href="https://www.facebook.com/seniortraveler"> Facebook</a> | <a href="https://twitter.com/senortraveler">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54e996177d67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hiking in the Dead Sea - From Ein Gedi and Wadi David to Wadi Arugot]]></title>
            <link>https://nirtayeb.medium.com/hiking-in-the-dead-sea-from-ein-gedi-and-wadi-david-to-wadi-arugot-453bb1708935?source=rss-6535621c20e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/453bb1708935</guid>
            <category><![CDATA[travel-tips]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[israel]]></category>
            <category><![CDATA[dead-sea]]></category>
            <category><![CDATA[hiking]]></category>
            <dc:creator><![CDATA[Nir Tayeb]]></dc:creator>
            <pubDate>Fri, 25 May 2018 09:20:44 GMT</pubDate>
            <atom:updated>2018-05-25T09:20:44.265Z</atom:updated>
            <content:encoded><![CDATA[<p>The Dead Sea is the lowest place on Earth. Literally! It’s 430.5 below sea level.</p><p>Usually, people go there to float on its very salty water, relaxing on the still water with a newspaper, and as a grand finale cover themselves with the mud that you can find on the salty beach.</p><p>The Dead Sea surrounded by enormous cliffs on its Israeli Side. Inside those cliffs, you can find plenty of valleys and streams (“Wadi” in Hebrew and Arabic) which are suitable for different types of hikes. If you like the extreme kind hike adventure, you should definitely visit<a href="https://www.youtube.com/watch?v=BaB_jJoqZUY&amp;index=1&amp;list=PL6ezPdDd7eJFe_mz-h1hrsZ-dmV-u6K3E"><strong> Wadi Darga</strong></a>, (which you can find out more about on a seperate post I wrote with a cool video). And if you are looking for more easy relaxed mood, don’t worry, there are also some easier ones, fun for everybody, like <strong>Ein Gedi and Wadi Arugot.</strong></p><p>People who like to trek can combine both of them for a full one day trek (7–8 hours) or two days and camp in between like I did with my friends.</p><p>The trek begins at the <strong>Oasis of Ein Gedi</strong> — a national park and a nature reserve, the biggest oasis in Israel. Since the beginning of the trail you can enjoy the palm trees, see some wild goats, and get very quickly to waterfalls there you can enjoy their water flow (all year long, what a desert miracle!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQjkgFDRbBLePBACd0bQLQ.jpeg" /></figure><p>After enjoying the coolness of the water, it is time to begin the climbing up to “Ein Gedi” Spring, where you could rest a bit after the long climbing. On the way, you will be able to see a panoramic view of the Dead Sea (which is nothing in comparison to the next viewpoint! Wait for it, it is going to be legen…).</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/BckaF_qnROm/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252Fec6318cb5fa28d0b04a8837029acb486%252F5B9B1785%252Ft51.2885-15%252Fs640x640%252Fsh0.08%252Fe35%252F25010715_135996957081524_3588275004908765184_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/0dc77a4fdd1ba07379148169d7f43ab2/href">https://medium.com/media/0dc77a4fdd1ba07379148169d7f43ab2/href</a></iframe><p>Have some rest in the “Ein Gedi” springs, and fill your empty bottle at the spring, which have clean mineral water (we buy them at grocery stores), you will need them later!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zk8UYkztj1s_I5BolKJoKw.jpeg" /><figcaption>Me and my father resting at the springs</figcaption></figure><p>From here, it is the beginning of the toughest climbing in the trek — we climbed up to an altitude of 150m above sea level (600m of elevation gain!). The climbing is very stiff, and it is also a desert — we took some long breaks in the little-shadowed areas along the way.</p><p>Eventually, after finishing climbing, we got to the highest viewpoint of The Dead Sea on the trek — “Ein Gedi viewpoint.”</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/Bi_9IuVgr_s/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252F64d8b6842fa7e2dd6bfe506055e3600b%252F5B7B4FED%252Ft51.2885-15%252Fs640x640%252Fsh0.08%252Fe35%252F31928255_399561787189802_4162273306432503808_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="426" frameborder="0" scrolling="no"><a href="https://medium.com/media/b86e99ee208659dd6c047e1608f74a6d/href">https://medium.com/media/b86e99ee208659dd6c047e1608f74a6d/href</a></iframe><p>Later we have found a place to do camping outside of the national park (you will see a sign there).</p><p>On the second day, we went south to Wadi Arugot, one of the primary water sources of the Dead Sea. The look from above was… dary! legendary!</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/BjHrki8FaWo/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252F77e09a9cf1e8e15af967840d9d9ac726%252F5B82F6AC%252Ft51.2885-15%252Fs640x640%252Fsh0.08%252Fe35%252F31982753_665606683770902_3172015476184186880_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="426" frameborder="0" scrolling="no"><a href="https://medium.com/media/3934aa0d6a55b48e341a06533056c51c/href">https://medium.com/media/3934aa0d6a55b48e341a06533056c51c/href</a></iframe><p>It is also where you should have your new profile picture ;)</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/BjKQV6wFkSa/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252F68ebc442350c53cab48e3ce6f5e9fcb5%252F5B87C03C%252Ft51.2885-15%252Fs640x640%252Fsh0.08%252Fe35%252F32053517_242118289700723_1479916477455794176_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="426" frameborder="0" scrolling="no"><a href="https://medium.com/media/3cb4405ba642bb4d75d8c8238205a4b3/href">https://medium.com/media/3cb4405ba642bb4d75d8c8238205a4b3/href</a></iframe><p>We descended all the way down following the stream, which is very stiff as thoroughly, and need to walk there with a lot of attention so you won’t make rock slide down the wadi and careful that you won’t roll with the stones on the stiff sectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMXj3d7a27JUe40Xvx6lKQ.jpeg" /></figure><p>Once we got down to the stream, we took the “red” trail, and went all the way up to the “Upper pools.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zp5jF8ZIC8h3LWx9K2QDLQ.jpeg" /></figure><p>After taking an extended break enjoying the pools, we began our way to exit the stream (which is the entrance if you do only Wadi Arugot as half day trip). All the road is inside the water stream. The flow is very gentle and suitable for walking.</p><p>This video will demonstrate you the highlights of the second day.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbjJhukveWh0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbjJhukveWh0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbjJhukveWh0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1cb202b7d0377eb98d249720891d5f57/href">https://medium.com/media/1cb202b7d0377eb98d249720891d5f57/href</a></iframe><p>I hope you find this guide helpful, and that I inspired you to have a beautiful hike in the lowest place in the world.</p><p>Comment for any question,<br>Clap and follow to show appreciation,</p><p>Come and join my adventures all around the globe! follow me on social media for more travel tips about Israel.I’m local and very enthusiastic about helping everyone to enjoy my beautiful country.</p><p><a href="https://www.youtube.com/channel/UCXAm4j2uLwijFeBAURox79w">YouTube</a> | <a href="https://www.instagram.com/senortraveler/">Instagram</a> | <a href="https://www.facebook.com/seniortraveler">Facebook</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=453bb1708935" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>