<?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 Shpëtim Islami on Medium]]></title>
        <description><![CDATA[Stories by Shpëtim Islami on Medium]]></description>
        <link>https://medium.com/@draodakum?source=rss-2f09971c7579------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PMuN7BQHekzf9CPsUMe4Jw.jpeg</url>
            <title>Stories by Shpëtim Islami on Medium</title>
            <link>https://medium.com/@draodakum?source=rss-2f09971c7579------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:28:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@draodakum/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[How We Built a Multi-Region WebSocket Server in Go]]></title>
            <link>https://medium.com/@draodakum/how-we-built-a-multi-region-websocket-server-in-go-9f41d3efe008?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f41d3efe008</guid>
            <category><![CDATA[realtime]]></category>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 20:19:34 GMT</pubDate>
            <atom:updated>2026-04-01T20:20:54.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pSBRrEesQoNpcPum" /><figcaption>Photo by <a href="https://unsplash.com/@rstone_design?utm_source=medium&amp;utm_medium=referral">Ryan Stone</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Real-time infrastructure is one of those things that sounds simple — “just send messages between clients” — until you need it to work across regions, handle tens of thousands of concurrent connections per node, and never lose a message. We built <a href="https://apinator.io/">Apinator</a>, a multi-region WebSocket server in Go, and along the way learned hard lessons about fan-out, presence tracking, and keeping the data plane fast.</p><p>This post walks through the architecture decisions that matter most. No hand-waving — real patterns with real trade-offs.</p><h4>The Split: Control Plane vs. Data Plane</h4><p>The single most impactful decision we made was splitting the system into two independently deployable binaries:</p><p><strong>Control plane</strong>— account management, configuration. Talks to PostgreSQL and Redis. Deployed once, centrally.</p><p><strong>Data plane</strong> — WebSocket connections, event publishing, channel auth. Talks to Redis only. Deployed per region.</p><p>The architecture looks like this: the control plane sits centrally with PostgreSQL and Redis. Each region (EU, US, etc.) runs its own data plane that only needs Redis. The data planes talk to the control plane over HTTP for tenant resolution, and use Redis Pub/Sub for cross-node message fan-out.</p><p><strong>Why this matters:</strong> The data plane has zero PostgreSQL dependency. It resolves tenant data (apps, API keys) through a Redis cache with an HTTP fallback to the control plane. This means you can deploy a new data plane node in any region and it starts serving WebSocket connections immediately — no database migration, no schema sync.</p><p>The cache fallback pattern looks like this:</p><pre>// 1. Try Redis cache<br>data, err := c.rdb.Get(ctx, “app:”+appID).Bytes()<br>if err == nil {<br> return unmarshal(data)<br>}<br><br>// 2. Cache miss — ask the control plane<br>resp, err := c.httpClient.Get(c.controlPlaneURL + “/internal/v1/apps/” + appID)<br><br>// 3. Write back to cache for next time<br>c.rdb.Set(ctx, “app:”+appID, body, c.cacheTTL)</pre><p>Simple, but it means a data plane node in São Paulo can serve 50,000 connections while the control plane in Frankfurt is temporarily unreachable — cached data keeps things running.</p><h4>Cross-Node Fan-Out Without Head-of-Line Blocking</h4><p>When a client publishes a message to a channel, every subscriber on every node needs to receive it. We use Redis Pub/Sub for this, but the naive approach has a problem: if one subscriber is slow (full send buffer, flaky connection), it blocks delivery to everyone else.</p><p>Our solution: a worker pool that decouples Redis message reception from broadcast.</p><pre>const fanoutWorkers = 64<br><br>type RedisPubSub struct {<br> rdb *redis.Client<br> registry *channel.Registry<br> refCounts map[string]int<br> fanoutCh chan *redis.Message<br> mu sync.Mutex<br>}<br><br>func (ps *RedisPubSub) Start(ctx context.Context) {<br> for i := 0; i &lt; fanoutWorkers; i++ {<br> go ps.fanoutWorker(ctx)<br> }<br> go ps.receiveLoop(ctx)<br>}<br><br>func (ps *RedisPubSub) fanoutWorker(ctx context.Context) {<br> for msg := range ps.fanoutCh {<br> appID, channel := parseTopic(msg.Channel)<br> ps.registry.Broadcast(appID, channel, []byte(msg.Payload))<br> }<br>}</pre><p>The <strong>receiveLoop</strong> reads from Redis and pushes into a buffered channel. 64 workers pick up messages and broadcast them. A slow broadcast on channel A doesn’t delay channel B — they’re handled by different workers.</p><h4><strong>Reference-Counted Subscriptions</strong></h4><p>We don’t subscribe to every channel on every node. Instead, we ref-count:</p><pre>registry := channel.NewRegistry(func(appID, channelName string, count int) {<br> switch count {<br> case 1:<br> // First local subscriber — subscribe to Redis<br> pubsub.Subscribe(ctx, “realtime:”+appID+”:”+channelName)<br> case 0:<br> // Last local subscriber left — unsubscribe from Redis<br> pubsub.Unsubscribe(ctx, “realtime:”+appID+”:”+channelName)<br> }<br>})</pre><p>If no one on the EU node is in <strong>private-notifications</strong>, that node doesn’t receive those messages from Redis at all. In a system with thousands of channels but uneven distribution across regions, this dramatically reduces Redis throughput.</p><h4>Presence Tracking Across Tabs and Nodes</h4><p>Presence channels (who’s online?) are deceptively hard. The basic version is easy — but then someone opens your app in three browser tabs, and you need to show them as <em>one</em> member, not three. And when they close two tabs, they should stay online. Close the last tab? Now they’re offline.</p><p>We solved this with two Redis data structures per presence channel:</p><p>A <strong>Hash</strong> (<strong>presence:{app}:{channel}:members</strong>) maps userID to user info JSON. One entry per unique user.</p><p>A <strong>Sorted Set</strong> (<strong>presence:{app}:{channel}:heartbeats</strong>) maps userID:connID to a timestamp. One entry per connection (tab).</p><p>The join operation is a Lua script for atomicity:</p><pre>local existed = redis.call(‘HEXISTS’, KEYS[1], ARGV[1])<br>redis.call(‘HSET’, KEYS[1], ARGV[1], ARGV[2])<br>redis.call(‘ZADD’, KEYS[2], ARGV[3], ARGV[4])<br>if existed == 0 then return 1 else return 0 end</pre><p>If the script returns <strong>1</strong>, this is a genuinely new member — broadcast <strong>member_added</strong>. If it returns <strong>0</strong>, it’s just another tab from an existing member — no broadcast needed.</p><p>On disconnect, we remove the connection’s heartbeat entry and check if any heartbeats remain for that user:</p><pre>remaining := rdb.ZCount(ctx, heartbeatKey, userID+”:*”)<br>if remaining == 0 {<br> rdb.HDel(ctx, membersKey, userID)<br> // Now broadcast member_removed<br>}</pre><p>A background sweep job cleans up stale heartbeats from connections that died without a clean close — crashed tabs, lost network, etc.</p><h4>Adaptive Broadcast: From 10 to 10,000 Subscribers</h4><p>Not all channels are created equal. A private notification channel has 1 subscriber. A live sports channel might have 10,000. Using goroutines for every broadcast is wasteful at small scale and necessary at large scale.</p><p>We use a threshold:</p><pre>const broadcastParallelThreshold = 128<br>const broadcastChunkSize = 256<br><br>func (r *Registry) Broadcast(appID, channel string, data []byte) int {<br> subs := r.getSubscribers(appID, channel)<br><br>if len(subs) &lt; broadcastParallelThreshold {<br> for _, s := range subs {<br> s.Send(data)<br> }<br> return len(subs)<br> }<br><br>var wg sync.WaitGroup<br> for i := 0; i &lt; len(subs); i += broadcastChunkSize {<br> chunk := subs[i:min(i+broadcastChunkSize, len(subs))]<br> wg.Add(1)<br> go func(c []Subscriber) {<br> defer wg.Done()<br> for _, s := range c {<br> s.Send(data)<br> }<br> }(chunk)<br> }<br> wg.Wait()<br> return len(subs)<br>}</pre><p>Under 128 subscribers? A simple loop. Over 128? We split into chunks of 256 and fan out across goroutines. This avoids spawning 10,000 goroutines while still parallelizing the work.</p><h4>Connection Lifecycle: The Dual-Pump Pattern</h4><p>Each WebSocket connection runs three goroutines:</p><pre>go c.readPump(ctx) // reads client messages<br>go c.writePump(ctx) // sends queued messages<br>go c.pingLoop(ctx) // keepalive heartbeat</pre><p><strong>Why separate read and write?</strong> A client that’s slow to read (congested network, mobile on 3G) would block other messages in its send queue if we wrote synchronously. The write pump drains a buffered channel independently:</p><pre>func (c *Connection) writePump(ctx context.Context) {<br> for {<br> select {<br> case msg, ok := &lt;-c.send:<br> if !ok { return }<br> c.wsConn.Write(ctx, websocket.MessageText, msg)<br> case &lt;-ctx.Done():<br> return<br> }<br> }<br>}</pre><p>The <strong>send</strong> channel acts as a per-connection buffer. If it fills up (client truly can’t keep up), we drop the connection rather than accumulating memory.</p><p>Close handling uses <strong>sync.Once</strong> to guarantee cleanup runs exactly once, even when both pumps detect the disconnect simultaneously:</p><pre>c.closeOnce.Do(func() {<br> close(c.done)<br> c.wsConn.Close(code, reason)<br> c.onClose(c)<br>})</pre><h4>Metrics Without Touching the Hot Path</h4><p>Every message and connection needs metering, but we can’t add latency to the message delivery path. We use lock-free atomic counters:</p><pre>type AppMetrics struct {<br> MessagesPublished atomic.Int64<br> MessagesDelivered atomic.Int64<br> ConnectionsOpened atomic.Int64<br> MessagesPublishedRate atomic.Int64<br> MessagesDeliveredRate atomic.Int64<br>}</pre><p>On every message: <strong>metrics.MessagesDelivered.Add(int64(subscriberCount))</strong>— a single atomic operation, no locks, no contention.</p><p>Two independent snapshot cycles read and reset these counters:</p><p><strong>Every 60 seconds:</strong> Full snapshot for metrics. Data plane POSTs to the control plane with an idempotent flush ID (<strong>nodeID:windowTimestamp</strong>) so retries don’t double-count.</p><p><strong>Every 1 second:</strong> Rate snapshot for live dashboards, published via Redis Pub/Sub to an SSE endpoint.</p><pre>windowStart := time.Now().Truncate(60 * time.Second)<br>flushID := fmt.Sprintf(“%s:%d”, nodeID, windowStart.Unix())<br>// Control plane upserts: same flushID = same window = no double count</pre><h4>Rate Limiting With a Lua One-Liner</h4><p>We use a sliding window rate limiter implemented as a single Redis Lua script:</p><pre>redis.call(‘ZREMRANGEBYSCORE’, KEYS[1], ‘-inf’, ARGV[1] — ARGV[2])<br>local count = redis.call(‘ZCARD’, KEYS[1])<br>if count &lt; tonumber(ARGV[3]) then<br> redis.call(‘ZADD’, KEYS[1], ARGV[1], ARGV[1] .. ‘:’ .. math.random(1000000))<br> redis.call(‘EXPIRE’, KEYS[1], ARGV[2])<br> return {1, ARGV[3] — count — 1, ARGV[3]}<br>else<br> return {0, 0, ARGV[3]}<br>end</pre><p>Each request is a member in a sorted set, scored by timestamp. Old entries are pruned, remaining entries are counted. The whole thing is atomic — no race conditions between cleanup and check.</p><p>Why sliding window instead of fixed window? Fixed windows allow burst traffic at window boundaries (199 requests at 0:59, then 200 at 1:00 = 399 in 2 seconds). Sliding window smooths this out.</p><h4>Graceful Degradation: Works Without Redis</h4><p>Here’s a detail we’re proud of: the data plane works without Redis. At startup:</p><pre>redisAvailable := rdb.Ping(ctx).Err() == nil<br><br>if redisAvailable {<br> pubsub = pubsub.NewRedisPubSub(rdb, registry)<br> presence = channel.NewRedisPresence(rdb)<br>} else {<br> pubsub = pubsub.NewLocalPubSub(registry)<br> presence = channel.NewLocalPresence()<br>}</pre><p>In single-node mode (development, testing, or a degraded production state), everything works with in-memory implementations. Messages still fan out to local subscribers. Presence still tracks members. You lose cross-node communication, but you don’t lose functionality.</p><p>This made local development trivial —<strong>go run ./cmd/realtime</strong> just works with no infrastructure dependencies.</p><h4>What We’d Do Differently</h4><p><strong>Message ordering guarantees.</strong> Redis Pub/Sub is at-most-once and doesn’t guarantee ordering across nodes. For most real-time use cases (chat, notifications, live updates) this is fine. For financial data or collaborative editing, you’d want a log-based system (Redis Streams or Kafka). We chose simplicity.</p><p><strong>Presence at scale.</strong> Our Redis Hash + Sorted Set approach works well up to around 10K members per channel. Beyond that, you’d want a CRDT-based approach or partitioned presence. We haven’t hit this limit in practice.</p><p><strong>Lua script testing.</strong> Testing Redis Lua scripts is painful. We ended up with integration tests using miniredis, but there’s no great unit testing story for Lua embedded in Go strings. If we started over, we might extract them into <strong>.lua</strong> files with a dedicated test harness.</p><h4>Try It</h4><p>If you’re building something that needs real-time WebSocket infrastructure, <a href="https://apinator.io/">Apinator</a>.io is the server we wished existed when we started. Multi-region by default, SDKs for every major language, and you can self-host if that’s your thing.</p><p>The architecture patterns above aren’t specific to our use case — they apply to any system pushing messages to many concurrent connections. Steal freely.</p><p><em>Have questions about the implementation? Find us at </em><a href="https://apinator.io/"><em>https://apinator.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f41d3efe008" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Reasons Why Server-Side Rendering is the Future of the Web]]></title>
            <link>https://medium.com/laraveladvanced/5-reasons-why-server-side-rendering-is-the-future-of-the-web-52ff940f7477?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/52ff940f7477</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Sun, 11 Dec 2022 23:29:09 GMT</pubDate>
            <atom:updated>2022-12-11T23:29:09.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*in13Ht2rum_iCoz1" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>Improved performance.</li><li>Better search engine visibility.</li><li>Faster time-to-interactive.</li><li>More efficient use of server resources.</li><li>Improved user experience.</li></ol><p>Server-side rendering (SSR) is a popular technique for rendering dynamic web pages. It involves rendering the content of a web page on the server before sending it to the client, rather than rendering the page on the client using JavaScript. This has several advantages, including improved performance and the ability to crawl and index the page for search engines.</p><h3><strong>Improved performance</strong></h3><p>One of the key benefits of SSR is improved performance. When a client requests a web page that uses SSR, the server pre-renders the page and sends it to the client as a fully-formed HTML document. This means that the client’s web browser can start rendering the page immediately, without having to wait for any JavaScript to be downloaded and executed. This can significantly improve the time it takes for the page to become usable, especially on mobile devices with slower network connections.</p><h3>Better search engine visibility</h3><p>Another advantage of SSR is that it makes it easier for search engines to crawl and index dynamic web pages. Since the content of the page is pre-rendered on the server, search engines can easily access and index the content, making it more likely to appear in search results. This is especially important for web pages that use JavaScript-based frameworks, which can sometimes be difficult for search engines to access.</p><h3>Conclusion</h3><p>Overall, server-side rendering is a powerful technique that can improve the performance and search engine optimisation of dynamic web pages. It is particularly well-suited for applications that require fast page loads and good search engine visibility, such as e-commerce and news sites.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52ff940f7477" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/5-reasons-why-server-side-rendering-is-the-future-of-the-web-52ff940f7477">5 Reasons Why Server-Side Rendering is the Future of the Web</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance testing your application]]></title>
            <link>https://medium.com/laraveladvanced/performance-testing-your-application-8bf832eeb471?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bf832eeb471</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 12:14:58 GMT</pubDate>
            <atom:updated>2021-12-22T12:21:16.843Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z5KATMTY70ZwT6Cs" /><figcaption>Photo by <a href="https://unsplash.com/@cinusek?utm_source=medium&amp;utm_medium=referral">Marcin Simonides</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You are ready to deploy your application and have your server/s set up but not sure how many requests or concurrent users it can handle. For this problem what you can do is perform few performance tests, which will simulate a predefined number of users making requests to your application.</p><p>Although there are more that can identify bottlenecks in your infrastructure, database etc. we will focus on 3 types of basic tests:</p><ul><li><strong>Stress tests</strong> will try to break the application by testing with bigger loads that it is expected to have in production, this way you will know what is the limit of the application.</li><li><strong>Load tests</strong> will try to simulate the expected number of load in production, it will ensure that the application will continue to meet required performance standards as the application is updated over time.</li><li><strong>Spike tests</strong> will try to simulate sudden spike of increased traffic to your application and know how the application can handle fluctuations</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*Ima-6IAfaNgBFhfjcQwF2w.png" /><figcaption>Visual representation of 3 different types of performance tests</figcaption></figure><h3>Enter Locust testing tool</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9lsYCYF0pxPgJ9iqXCZSg.png" /><figcaption>Locust web UI</figcaption></figure><p>We can run the performance tests with the open source testing tool called Locust (<a href="https://locust.io/">https://locust.io</a>). It provides 2 ways to run tests:</p><ul><li><strong>Web UI</strong> which provides a good interface to run and visualise the tests in real time.</li><li><strong>Headless</strong> which can be run directly a command terminal. This means you can integrate these tests as part of your CI/CD cycles.</li></ul><p>The tests can be written in Python.</p><h3>Let&#39;s get started!</h3><p>For this example we will use docker to run locust locally but if you have different python setup than you can easily install it using pip by typing in your terminal:</p><pre>pip install locust</pre><p>We assume you already have installed and running Docker. Go ahead in your terminal and create a new directory called locust, and inside of it we will need simply 2 files to get it running:</p><p>create<strong> </strong>the<strong> docker-compose.yml </strong>file and paste the content below:</p><pre>version: &#39;3&#39;</pre><pre>services:<br>  master:<br>    image: locustio/locust<br>    ports:<br>     - &quot;8089:8089&quot;<br>    volumes:<br>      - ./:/mnt/locust<br>    command: -f /mnt/locust/locustfile.py --master -H <a href="http://master:8089/">http://master:8089</a></pre><pre>worker:<br>    image: locustio/locust<br>    volumes:<br>      - ./:/mnt/locust<br>    command: -f /mnt/locust/locustfile.py --worker --master-host master</pre><p>Here we have defined the docker compose config to create 2 containers/services <strong>master</strong> and <strong>worker.</strong></p><ul><li><strong>Master</strong> is the orchestrating the tests</li><li><strong>Worker</strong> is the actual worker that runs the tests</li></ul><p>Create the <strong>locustfile.py </strong>and paste the content below:</p><pre>import time<br>from locust import HttpUser, task, between</pre><pre>class QuickstartUser(HttpUser):</pre><pre>    @task<br>    def index_page(self):<br>        self.client.get(&quot;/&quot;)</pre><p>This is a very simple test that goes to the root (main domain) of the URL on every virtual user request.</p><h3>Let’s get running</h3><p>once we have the above 2 files ready simply go ahead and run:</p><pre>docker-compose up -d</pre><p>Which will create and run 2 containers (master and worker), make sure they are up by running <strong>docker ps</strong> in your terminal.</p><p>Then go ahead and visit <a href="http://localhost:8089/">http://localhost:8089</a>, and you will be able to see the below interface:</p><blockquote>port 8089 is defined in the docker-compose file above</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1miWvt_0bCeU6NPulM5NnA.png" /><figcaption>Start new test</figcaption></figure><p>Here we have defined 1000 as maximum virtual users and to be spawned 10 every second until it reaches 1000. Click <strong>Start swarming </strong>and you will be provided with real time results/reports of the testing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMEf_iUt1Ojhe0poi_XzwA.png" /></figure><h3>The end</h3><p>This was a simple tutorial and introduction to performance testing, for more information and advanced tests examples to perform different tasks please visit the official Locust documentation: <a href="http://docs.locust.io/en/stable/">http://docs.locust.io/en/stable</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bf832eeb471" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/performance-testing-your-application-8bf832eeb471">Performance testing your application</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Docker for Laravel development and production]]></title>
            <link>https://medium.com/laraveladvanced/using-docker-for-laravel-development-and-production-df6398d5c93?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/df6398d5c93</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 13:42:42 GMT</pubDate>
            <atom:updated>2020-06-03T13:42:42.472Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SC9oylwuUFgcVzq1" /><figcaption>Photo by <a href="https://unsplash.com/@cjred?utm_source=medium&amp;utm_medium=referral">CJ Dayrit</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>This is not just another story about a tool to look cool.</blockquote><h3>Why Docker with Laravel?</h3><p>So let us talk about why would one use Docker when there are other options such as Xampp, Vagrant and many more. The most common explanation for Docker on Wikipedia is:</p><blockquote>An open-source project that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation of OS-level virtualization on Linux.</blockquote><ul><li>Docker is a bit difficult to understand its core concepts at first, but it is really easy once you get the hang of it and it is easy to modify different stacks, add new services and this is what I like the most — in case you need for example at some point during development to use Redis, Elastic search, SFTP server or any other service, you just have to include it in the so called <strong>docker-compose </strong>file.</li><li>If you build your application as a Docker image, deploy and use it in production, it is going to be <strong>1:1</strong> locally and in production with the source code and web server settings, so you avoid having problems like: <em>“oh it works locally but not in production” </em>because you forgot that you have not installed a PHP module in your production but you have it locally.</li><li>On-boarding new team members or switching working machines has never been easier.<br>A new team member can clone the repo of the project which contains the docker files and all he/she has to do from there is to execute <strong>docker-compose up</strong> and it will build the project with the necessary services.</li></ul><h3>Reusability</h3><p>The way I like to think about docker images is like a PHP class, which can be inherited many times. An example of such inheritance can be:</p><ul><li>Image of our project with its source code inherits PHP and Apache image</li><li>Then we can have other image(s) inheriting the image built in the first step.</li></ul><figure><img alt="Laravel on Docker containers" src="https://cdn-images-1.medium.com/max/541/1*vsam0M9qNNiQ6jsJXHDdxg.png" /></figure><p>Which means that you can create a base image for your project or future projects, and by maintaining that core image you will have up to date application settings like PHP, Apache, Nginx or whatever your application is using.</p><h3>Action</h3><p>Let us create the <strong>Docker </strong>file<strong> </strong>for our project:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc13f6d4495b3d9114d6c68a824a3425/href">https://medium.com/media/fc13f6d4495b3d9114d6c68a824a3425/href</a></iframe><p>In the Dockerfile above, you can see the commands it runs to build the project image for Laravel in this example.</p><p>The lines 2 and 3 are important because that is how you define the php.ini settings, and they are in the git also. Feel free to use the file above to modify and improve it.</p><p>And <strong>docker-compose</strong> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6480a2d56c89945d9cc6b440e8355fe6/href">https://medium.com/media/6480a2d56c89945d9cc6b440e8355fe6/href</a></iframe><p>In this example there are 5 services/containers:</p><ol><li><strong>Laravel</strong> project source code container at line: 3</li><li><strong>MySQL</strong> container at line: 39</li><li><strong>MongoDB</strong> container at line: 50</li><li><strong>Redis</strong> container at line: 59</li><li><strong>FTP server </strong>container at line: 66</li></ol><p>As you can see here you define easily what you need to use. All you have to do is looking up on <a href="https://hub.docker.com/">Docker hub</a> to find the container/service you need for your project add it in the Docker compose file and you are done and can use it.</p><p>In the example above it is a Laravel project which consists of 1 Docker file to create the Laravel image and Docker compose file to orchestrate the other services for local development.</p><p>There is no need for custom image for other services because we can use the official ones, but if the application is a microservice architecture than it would mean that more Docker files are required and you have to include them in the Docker compose file just as you use the other services. Generally you should avoid managing services like MySQL, Redis or MongoDB so that is why we are just building the application image. It is best to use managed Database services for Production and use them as containers for local development.</p><h3>Production deployment</h3><p>To deploy this to production it is best to use CI/CD tools to build the images and run the tests, but for an easier deployment you can use the <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/single-container-docker.html">AWS beanstalk for single containers</a>. <br>You can read this article about Scaling Laravel on AWS beanstalk: <a href="https://medium.com/laraveladvanced/scalable-laravel-on-aws-the-ultimate-guide-b67d9133638">https://medium.com/laraveladvanced/scalable-laravel-on-aws-the-ultimate-guide-b67d9133638</a></p><p>Which is essentially the same, except that you have to select Docker for single containers as the type for beanstalk.</p><p>This way Beanstalk will take care of building the image for you from your source code.</p><p>Now the most important part is to have other features of Laravel like the scheduler and the Queue worker server. For this we can add in our Docker file these last 2 lines:</p><pre>EXPOSE 80<br>CMD [&quot;/usr/local/bin/start&quot;]</pre><p>Which will run a start.sh bash file which we are already copying to /usr/local/bin/start on line 5 in the Docker file.</p><p>Based on what you set as your environment variables it will run the appropriate artisan commands</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d44f4381f94e2c4ff5e9b3a8612eb55/href">https://medium.com/media/8d44f4381f94e2c4ff5e9b3a8612eb55/href</a></iframe><p>Feel free to use the example files above to modify and improve them. What I have discussed till now is a more narrow example of using Docker for Monolithic Laravel application for development and deploying it in AWS beanstalk for production but this does not mean by any means that this is the final answer, there are a lot of other ways for deployment and how you set up your project.</p><p>Kubernetes is one of those ways to orchestrate your containers but it is out of the scope of this story. It is up to you to decide what you want to use for your deployments and the architecture of your application.</p><h3>Cheat sheet</h3><p>List all running Docker containers:</p><pre>docker ps</pre><p>Start Docker containers for a given project:</p><pre>docker-compose up -d</pre><p>Execute an interactive <strong>bash</strong> shell on the container:</p><pre>docker exec -it {container_id} bash</pre><p>Stop Docker containers for given project:</p><pre>docker-compose stop</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df6398d5c93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/using-docker-for-laravel-development-and-production-df6398d5c93">Using Docker for Laravel development and production</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rules for beginners to write scalable applications]]></title>
            <link>https://medium.com/laraveladvanced/rules-for-beginners-to-write-scalable-applications-9a8b28b123bc?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a8b28b123bc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 06:31:00 GMT</pubDate>
            <atom:updated>2020-03-29T18:00:34.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9mW6NGfyp_NMGOz9" /><figcaption>Photo by <a href="https://unsplash.com/@helloquence?utm_source=medium&amp;utm_medium=referral">Helloquence</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What is a scalable application?</p><p>In short a scalable web application is the ability or capacity of a system to have multiple instances based on the load of the work it has do.<br>In the past and now also, you are probably used to work on a project, put it on a virtual machine or dedicated server which works fine, or does it?</p><p>Have you ever come to a situation when you have to <strong>restart your server because some requests or all of them fail</strong>?<br>It happened to all of us, but did restarting the server solve the problem? <br>Probably not!</p><p>There are many reasons for this to happen but the main problem is that our server can handle a limited number of concurrent connections. Let us go through some points and rules to build a proper application keeping in mind that it will have to handle a bigger load/traffic and we want to be prepared for it.</p><h3>1. Load balancer</h3><p>The key component and the first thing is you need to set up or use managed load balancer from your hosting provider be it in AWS, Google Cloud, Azure or whatever. <br>2 good things to do here is to do frequent health checks on the instances, and make sure new/old instances are registered to your load balancer to achieve auto scaling and avoid unhealthy instances from being used.</p><h3>2. Caching</h3><p>If you achieved instance scaling, it does not mean your application has solved all the limitations.<br>Most probably you will be using a database for your application be it in Mysql, Postgres or any other database and they have their limitations also, so this means that you will have a bottleneck with the database which cannot serve your many instances.<br>Caching comes into play here because you will avoid hitting the database for every request.</p><h3>3. Storage</h3><p>This rule is very important to keep in mind because might have done a upload functionality for images or files and store it to some folder. <br>In scalable applications the above mentioned feature will have problems, and to demonstrate that lets assume the following scenario:</p><ol><li>You have scalable application which at the moment has 3 instances, lets call them <strong>instance A</strong>,<strong> instance B</strong> and <strong>instance C.</strong></li><li>A visitor uploads an image</li><li>the load balancer routes that request to the <strong>instance A</strong></li><li>The image is saved in the folder of the <strong>instance A</strong></li><li>When he refreshes he expects to see the uploaded image</li><li>Now the load balancer routes that request to the<strong> instance B</strong></li><li>Now <strong>only instance A has the image</strong> and<strong> instance B does not</strong>, so the visitor will get a error that the image does not exist.</li></ol><p>To avoid this you can use cloud storages like S3 from AWS or shared disk but shared disks are usually slower so cloud storages would be the way to go.</p><p>The logs of your application by default will probably be written in file/s, in this case your should stream them to <strong>stdout </strong>and from there send them to another database or use services like Cloudwatch from AWS, or just use <a href="https://sentry.io/">Sentry </a>which is really good for this.</p><p><em>By any means you should be careful with what you save into the local storage.</em></p><p>The above mentioned rules are the basic steps to keep in mind, but the list goes on for more advanced scalability which are out of the scope for this guide but it is worth researching about database indexation for faster queries, queues for long running jobs to avoid request timeout, No-SQL databases which support shards, message brokers, designing your application as monolithic or micro-services etc.<br>All these play a role into the capacity of the system to scale.</p><h3>Final note</h3><p>It is a good practice to know the limitation of your instances so that you know when the system should scale and add more instances. This is called <strong>saturation point. <br></strong>To identify your <strong>saturation point</strong> a so called <strong>ramp up test</strong> should be used to stress test your single instances to the point where they become unstable.</p><p>For more on how to deploy your application on AWS with low costs check out this article: <a href="https://medium.com/laraveladvanced/scalable-laravel-on-aws-the-ultimate-guide-b67d9133638">How to scale laravel on AWS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a8b28b123bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/rules-for-beginners-to-write-scalable-applications-9a8b28b123bc">Rules for beginners to write scalable applications</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing charts with time-series data]]></title>
            <link>https://medium.com/laraveladvanced/optimizing-charts-with-time-series-data-3554003bf260?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/3554003bf260</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Sun, 08 Mar 2020 09:59:23 GMT</pubDate>
            <atom:updated>2020-03-10T17:11:08.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to optimize charts with time-series data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A9F29g1xP00z9gbI" /><figcaption>Photo by <a href="https://unsplash.com/@gtomassetti?utm_source=medium&amp;utm_medium=referral">Giorgio Tomassetti</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The problem</h3><p>Often we have to build charts out of <strong>time series</strong> data and make a chart where visitors/clients can choose a time range and then see the count of <strong>x</strong> topic every minute/hour/day.</p><p>All this is good till now but what if the volume of those data increases over time? you probably guessed it! you will end up in longer queries which will result in timeout, which means the chart cannot be displayed, so ultimately this means that our application is not <strong>scalable</strong> for big volume of data.</p><p>It does not matter if you are using <strong>MySQL</strong>, <strong>Postgres</strong>, <strong>MongoDB</strong> or whatever SQL/No-SQL database, it will not solve the problem. You can find this problem eventually later in time with the project or predict it sooner and not worry about it later.</p><h3><strong>The scenario</strong></h3><p>Imagine you are tracking visitors of a web site or multiple web sites, lets assume that of the web sites we are tracking has a lot of visitors and we want to show to our client a chart where they can see the count of unique visitors, page views and maybe some other events.</p><p>There are 2 ways we can go about this depending on our need if it has to be near real time or not.</p><h3>The solution</h3><p>What if we create a table/collection before hand and then just increment the count? Define a schema design and increment the count appropriate for the data point — I am going to take <strong>MongoDB</strong> collections as an example here:</p><p><strong>Page views collection</strong></p><pre>{<br>  &quot;total&quot; : 96342,<br>  &quot;type&quot; : &quot;page_views&quot;,<br>  &quot;date&quot; : &quot;2020-01-01&quot;<br>},<br>{<br>  &quot;total&quot; : 65039,<br>  &quot;type&quot; : &quot;page_views&quot;,<br>  &quot;date&quot; : &quot;2020-01-02&quot;<br>},<br>...</pre><p><strong>Unique visitors collection</strong></p><pre>{<br>  &quot;total&quot; : 96342,<br>  &quot;type&quot; : &quot;unique_visitors&quot;,<br>  &quot;date&quot; : &quot;2020-01-01&quot;<br>},<br>{<br>  &quot;total&quot; : 65039,<br>  &quot;type&quot; : &quot;unique_visitors&quot;,<br>  &quot;date&quot; : &quot;2020-01-02&quot;<br>},<br>...</pre><p>Here we have sample counts representing one day granularity. You can combine both types into single collection or table, but it means that you have to define the index on the type as well when choosing indexing.</p><blockquote>Now the query has to only select and return the <strong>total</strong> and <strong>date</strong> fields based on the selected time range and you do not have to do any type of querying anymore.</blockquote><p>In your application level, when a user visits the site we have to increment the <strong>total</strong> field based on the criteria if the visitor is unique, page views etc.. and in the end we will have real time updates if we want to have near real time charts. example pseudo code:</p><pre>if ( user.isVisting()) {</pre><pre>  collection(&#39;page_views&#39;)<br>    .where(&#39;date&#39;, date.today)<br>    .increment(&#39;total&#39;)</pre><pre>}</pre><p>Another example of saving the data based on per minute granularity:</p><pre>{<br>    &quot;total&quot; : {<br>        &quot;0&quot; : 4123,<br>        &quot;1&quot; : 123,<br>        &quot;2&quot; : 4123,<br>        …<br>        &quot;59&quot; : 4634<br>    },<br>   &quot;hour&quot; : &quot;01&quot;,<br>   &quot;date&quot; : &quot;2020-01-01&quot;,<br>   &quot;type&quot; : &quot;page_views&quot;<br>},<br>   {<br>    &quot;total&quot; : {<br>        &quot;0&quot; : 555,<br>        &quot;1&quot; : 234,<br>        &quot;2&quot; : 2342,<br>        ...<br>       &quot;59&quot; : 456546<br>    },<br>    &quot;hour&quot;:&quot;02&quot;<br>    &quot;date&quot; : &quot;2020-01-02&quot;,<br>    &quot;type&quot; : &quot;page_views&quot;<br>},<br>...</pre><p>In case we don’t want to have near real time charts then we can have a task scheduler/cron job that counts based on the criteria and saves in the total field the appropriate results.</p><p>Will this slow down our tracking script time? — Yes it will! If the application is done right it should not make huge difference in the time to increment the count otherwise there are solutions to that also but maybe there will be another story about it (part 2 maybe), quick tip: <strong>Apache Kafka</strong>.</p><h3>Recommendations</h3><p>I would use <strong>Redis</strong> for saving time series data because of its performance in increment/decremented operations, otherwise <strong>MongoDB</strong> with proper indexing would be just great, even better if sharded based on the type of unit we are counting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3554003bf260" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/optimizing-charts-with-time-series-data-3554003bf260">Optimizing charts with time-series data</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to scale Laravel on AWS with very low server costs]]></title>
            <link>https://medium.com/laraveladvanced/scalable-laravel-on-aws-the-ultimate-guide-b67d9133638?source=rss-2f09971c7579------2</link>
            <guid isPermaLink="false">https://medium.com/p/b67d9133638</guid>
            <category><![CDATA[laravel-5]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Shpëtim Islami]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 15:19:39 GMT</pubDate>
            <atom:updated>2020-03-29T17:32:35.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ueo4zkxWfoNgcPR1" /><figcaption>Photo by <a href="https://unsplash.com/@wocintechchat?utm_source=medium&amp;utm_medium=referral">Christina @ wocintechchat.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I would like to start explaining why you would want to do this, well the following sums it up:</p><ul><li>We want to <strong>pay less</strong> server costs</li><li>We want to be able or be prepared to serve automatically <strong>huge number of requests</strong> without downtime</li><li>We want to have <strong>centralized</strong> place to store our <strong>access</strong> and <strong>error</strong> logs</li><li>More specifically since we are talking about Laravel, to have our queue jobs server handle more jobs at once.</li></ul><p>What scalable application is and how to write one, check out this article: <a href="https://medium.com/laraveladvanced/rules-for-beginners-to-write-scalable-applications-9a8b28b123bc">rules to write scalable application</a></p><p>Interested so far? OK then let’s start!</p><p>To go deeper into explaining the above mentioned goals, I would like to explain how can we achieve them.</p><p><strong>Q: </strong>How can we pay less and serve a lot of visitors at the same time?</p><p><strong>A:</strong> The trick here is not the AWS prices per say but the way we will build our application, luckily for us we will pay for things that we use only which means that if we have 1 server running for the whole month, and 1 other server running for 2 hours on “Black Friday” for the current month. We will only pay for only those 2 hours when we needed the other server. The servers themselves don’t have to be big monster servers with a lot of CPU and RAM capacity! The <em>t2.micro </em>instance type will do just fine in most Laravel projects which has just <strong>1vCPU</strong> and <strong>1GB Ram</strong>.</p><p><strong>Q:</strong> Anything to keep in mind when building scalable applications?</p><p><strong>A: </strong>Yes, the first thing is avoid saving files in the local file system, especially when allowing users to upload, because it will go into the server that the user is connected to at that time, and if you have more then 1 server running at that the same time, the next request might be served from another server and then the user will not be able to see what he uploaded!<br>To avoid this you can upload files into <strong>AWS S3 </strong>or use <strong>AWS EFS, </strong>I would prefer to go with the first option because setting up EFS is not that easy plus it is very slow but again it depends on the use case.</p><p>Lets get technical.</p><p>First step is to create a AWS account and Bitbucket account if you haven’t already!</p><p>There are going to be 2 environments, 1 for the web requests and 1 for queue jobs, so that we do not process long running queue jobs in the same place and have our server reject/delay requests because of resources are being used:</p><h3>Beanstalk web application</h3><ul><li>Create new Beanstalk application</li><li>Create new environment, choose <strong>Web server environment</strong></li><li>Choose <strong>PHP Platform</strong></li><li>Choose <strong>Sample application </strong>(for now)</li><li>Click on the button <strong>Configure more options (</strong>bottom right<strong>)</strong></li><li>Choose <strong>High availability (using Spot and On-Demand instances)</strong></li><li>Click <em>Modify </em>under the <strong>Software </strong>section, and check the box to <strong>Enable Log Streaming. </strong>This step will stream the access and error logs in <strong>CloudWatch </strong>which you can later group and query them, so that our life is easier when our application is in production.</li></ul><p>This is all for a sample application, click <strong>create environment</strong></p><h3>Beanstalk worker application</h3><ul><li>Create new Beanstalk application</li><li>Create new environment, choose <strong>Worker environment</strong></li><li>Choose <strong>PHP Platform</strong></li><li>Choose <strong>Sample application </strong>(for now)</li><li>Click on the button <strong>Configure more options (</strong>bottom right<strong>)</strong></li><li>Choose <strong>High availability (using Spot and On-Demand instances)</strong></li><li>Click <em>Modify </em>under the <strong>Software </strong>section, and check the box to <strong>Enable Log Streaming. </strong>This step will stream the access and error logs in <strong>CloudWatch </strong>which you can later group and query them, so that our life is easier when our application is in production.</li></ul><p>This is all for a sample application worker, click <strong>create environment</strong></p><h3>RDS for database</h3><p>I would recommend that you never manage the database on your own! it will give you a lot of headaches (depending on the size of the team).<br>So just go and create an <strong>RDS instance</strong> which is <strong>managed by AWS</strong> and you do not have to worry about availability, best practices, configurations, backups, monitoring etc.</p><p>Follow the official documentation from AWS: <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateDBInstance.html">https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateDBInstance.html</a></p><p>Until now if you followed all the steps above, we should have a sample application which can scale at low cost, have monitoring, and centralized logs. <br>Now we want to integrate our existing/new Laravel application into it.<br>To make life easy lets use<strong> Bitbucket pipelines</strong>, and the reason for using Bitbucket is because they offer more build time for <strong>free. </strong>With pipelines you can integrate a continues integration and continues delivery, meaning you push your changes and they will/can run tests and the deploy in production (beanstalk application we created above).</p><h3>Bitbucket pipeline for CI/CD</h3><p>Create a file named <strong>bitbucket-pipelines.yml</strong> in the root of your Laravel application an use the sample below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a6e85224053115071083f9465f46c50/href">https://medium.com/media/5a6e85224053115071083f9465f46c50/href</a></iframe><p>After replacing your settings for AWS with the placeholders in the sample yaml above, commit this into your project and push it to Bitbucket.<br>This will trigger a pipeline and and when it is finished it will deploy the same code to your web and worker environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b67d9133638" width="1" height="1" alt=""><hr><p><a href="https://medium.com/laraveladvanced/scalable-laravel-on-aws-the-ultimate-guide-b67d9133638">How to scale Laravel on AWS with very low server costs</a> was originally published in <a href="https://medium.com/laraveladvanced">Laravel advanced</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>