-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.xml
More file actions
337 lines (230 loc) · 25.4 KB
/
Copy pathindex.xml
File metadata and controls
337 lines (230 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>RedElastic</title>
<link>http://redelastic.com/index.xml</link>
<description>Recent content on RedElastic</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Sun, 12 Feb 2017 00:00:00 +0000</lastBuildDate>
<atom:link href="http://redelastic.com/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Blockchain: Reality or Marketing Hype?</title>
<link>http://redelastic.com/webinars/2017-01-02/</link>
<pubDate>Sun, 12 Feb 2017 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/webinars/2017-01-02/</guid>
<description><p>Blockchain has made waves in the news over the past year. In this webinar, we&rsquo;ll explore its relationship by diving into the practical implications of the technology, such as the practicality of a private blockchain in banking and early implementations such as BigchainDB.</p>
</description>
</item>
<item>
<title>Creating Evolutionary Architectures with Akka and DDD</title>
<link>http://redelastic.com/webinars/2016-12-20/</link>
<pubDate>Tue, 20 Dec 2016 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/webinars/2016-12-20/</guid>
<description><p>Architectures should be flexible and adaptable to ever-changing market conditions and business drivers. Unfortunately, most software architectures are inflexible and brittle. In this webinar we&rsquo;ll show you practical solutions for implementing radical agility in your systems through sound integration decisions using Akka, a distributed systems toolkit for the JVM.</p>
</description>
</item>
<item>
<title>Play Concurrency: Under the Hood</title>
<link>http://redelastic.com/blog/play-concurrency</link>
<pubDate>Mon, 19 Dec 2016 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/blog/play-concurrency</guid>
<description>
<p>Play is an MVC framework for the JVM that breaks away from the Servlet standard, which allocates a thread-per-request. Rather, Play embraces a fully reactive programming model through the use of <em>futures</em> for asynchronous programming and <em>work stealing</em> for maximizing available threads. Tight integration between Play and Akka also opens up avenues for distribution of work and state across clusters, even clusters that span data centers.</p>
<p>It is by far the most powerful and flexible MVC framework in the industry.</p>
<p>Not only does Play has some extreme advantages over Servlet-based MVC frameworks like Spring, it also fully supports two key languages on the JVM: Java and Scala.</p>
<h2 id="futures-actors-and-work-stealing">Futures, actors, and work stealing</h2>
<p>A combination of <em>futures</em>, <em>actors</em>, and <em>work stealing</em> makes Play one of the most flexible, performant, and resilient MVC frameworks in the industry.</p>
<p>Play employs <em>futures</em>, which can be considered a form of event-driven concurrency. This is nothing novel; many frameworks such as Node.js feature event-driven concurrency as well.</p>
<p>The clever innovation in Play is the use of <em>work stealing</em> for scaling up and <em>actors</em> for scaling out. This combination allows Play to scale out and in across both axis.</p>
<p>In order to understand what futures and work stealing bring to the table, we need to start from the bottom and work our way up. All example Play code is written in Scala, although Play also has an excellent API for Java.</p>
<h3 id="work-stealing">Work stealing</h3>
<p>Under the covers of Play, work stealing is implemented with the <a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html">ForkJoin Framework</a> (JSR-166). ForkJoin was first added to Java 7 and refined in Java 8, making it more efficient for Java developers to write concurrent/parallel code and avoid the complexities of locks, monitors, and synchronization.</p>
<p>Let’s explore parallelism as two distinct categories, divide-conquer and work stealing.</p>
<p><strong>Divide-conquer</strong> is the process of taking a long-running computation, splitting it up, and executing both sides of the computation in parallel before joining the results together. If we apply the same approach recursively, we can continue to divide our work into smaller and smaller halves until the individual tasks become small enough to compute.</p>
<p>For instance, if we’re summing a list of integers, we can decide that the largest list we want to work with has 1,000 elements. If the original list has 10,000 elements, we first split the list in half, and split those halves in half, and keep splitting until the maximum list size we work with has 1,000 elements. At that point we can execute the tasks in parallel and join the results together.</p>
<p>Divide-conquer makes efficient use of multi-core processors because creating smaller tasks and handing them off to the runtime makes it easier for the runtime to <em>schedule</em> the tasks according to the overall capacity of your system. For instance, if the CPU is mostly idle, the tasks can be spread across available cores and run in parallel, whereas if the CPU is already busy with other things the CPU can decide to interleave smaller tasks with other operations happening on the CPU so all programs make a reasonable amount of progress concurrently without hanging.</p>
<p><strong>Work stealing</strong> can be considered a subset of scheduling. ForkJoin implements a work-stealing technique when scheduling tasks that can be broadly described as follows:</p>
<blockquote>
<p>The fork/join framework is distinct because it uses a work-stealing algorithm. Worker threads that run out of things to do can steal tasks from other threads that are still busy.</p>
<p>— <a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html">http://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html</a></p>
</blockquote>
<p>ForkJoin is mostly abstracted away from Play developers, but it’s helpful to understand how it works when tuning Play for optimal performance.</p>
<p>Parallelism building blocks in ForkJoin are:</p>
<ul>
<li><code>ForkJoinPool</code> — An instance of this class is used to run all of your fork-join tasks</li>
<li><code>RecursiveTask&lt;V&gt;</code> — Run a subclass of this in a pool and have it return a result</li>
<li><code>RecursiveAction</code> — Run a subclass of this in a pool but without returning a result</li>
<li><code>ForkJoinTask&lt;V&gt;</code> — Superclass of <code>RecursiveTask&lt;V&gt;</code> and <code>RecursiveAction</code>; fork and join are methods defined in this class</li>
</ul>
<h3 id="actions-and-futures">Actions and Futures</h3>
<p>The core of the developer experience in Play are <em>actions</em>, which are tasks that are executed when an incoming request is routed to that action based on URI matching. An action can be defined as <em>synchronous</em> or <em>asynchronous</em>.</p>
<p>Because Play is built on top of Scala, a hybrid object/functional programming language, actions themselves are simply anonymous functions that return an <code>HttpResponse</code> (synchronous) or a <code>Future[HttpResponse]</code> (asynchronous).</p>
<p>The following action definition is synchronous:</p>
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%"><span></span><span style="color: #000080; font-weight: bold">def</span> joinGame <span style="color: #000080; font-weight: bold">=</span> Action { <span style="color: #000080; font-weight: bold">implicit</span> request <span style="color: #000080; font-weight: bold">=&gt;</span>
Ok(...)
}
</pre></div>
<p>The following is asynchronous:</p>
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%"><span></span><span style="color: #000080; font-weight: bold">def</span> joinGame <span style="color: #000080; font-weight: bold">=</span> Action.async { <span style="color: #000080; font-weight: bold">implicit</span> request <span style="color: #000080; font-weight: bold">=&gt;</span>
Future(Ok(...))
}
</pre></div>
<p>When we build Play applications in Scala, under the hood we can consider a <code>Future[T]</code> to be an abstraction on top of <code>ForkJoinTask&lt;V&gt;</code>. Understanding this fact becomes important when creating and tuning new <em>execution contexts</em>.</p>
<h3 id="execution-contexts-vs-thread-pools">Execution contexts vs thread pools</h3>
<p>In the above code, we can see that <code>Action.async</code> roughly maps to a <code>RecursiveAction</code> and is executed asynchronously on a <code>ForkJoinPool</code>.</p>
<p>We can also see that <code>Action</code> — a synchronous action — doesn&rsquo;t have a clear mapping to ForkJoin. Instead, <code>Action</code> maps to a thread that is executed on a thread pool.</p>
<p>Both ForkJoin and thread pools can be configured through Play as <em>execution contexts</em>, the high-level abstraction term for concurrency in Play.</p>
<h2 id="conclusion">Conclusion</h2>
<p>The syntactic difference is subtle but the runtime difference is profound. If we do not declare our actions as async, Play does not leverage ForkJoin; it assigns a thread to the lifecycle of the request and performs all computation synchronously. In situations where you may be tempted to pin a request to a thread in this fashion, you’re almost always better moving that work to Akka where you have significantly more options for distributing the work across VMs, servers, clusters, and data centers.</p>
<p>With all of the concurrency and distribution options at hand, Play is the perfect technology to use as a stateless API gateway or RESTful API layer in a broader enterprise architecture. It integrates very well with front-end technologies such as AngularJS and React along with back-end technologies like Akka.</p>
<p>Many people consider Play a simple MVC framework for rendering HTML. Although it comes with support for rendering HTML out of the box, that&rsquo;s a convenience; Play is perfectly suited to serving JSON and XML without HTML. Consider HTML rendering as a nice — but non-essential — facet of the Play experience.</p>
<p>What makes Play such a solid technology in front of waves of traffic is the concurrency model. No containers to deploy to. Ultimate flexibility of the deployment model.</p>
</description>
</item>
<item>
<title>Principle of Least Power with Play and Akka</title>
<link>http://redelastic.com/blog/principle-of-least-power</link>
<pubDate>Mon, 12 Dec 2016 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/blog/principle-of-least-power</guid>
<description><p>Language zealotry is not new, it’s been going on since the beginning of personal computers. Apple shipped with BASIC, and from the very beginning BASIC was held in contempt by Unix programmers.</p>
<p>While BASIC went on to become a highly popular programming language, Unix was eventually overshadowed by Linux and relegated to the history books. There&rsquo;s a sweet spot between purity and popularity that all technologies must keep in mind.</p>
<p>Unix programmers of the era didn’t fully appreciate the power of simplicity - that is, a programming language so simple that entire language could be held in the head of a developer. In the era of StackOverflow this may be considered a laughable value proposition, but there was a time when programmers needed to fully understand the tools they worked with; cut-and-paste code hasn&rsquo;t always been a few clicks away.</p>
<blockquote>
<p>Apple was founded in 1977, and advances came with almost unbelievable rapidity in the years that followed. The potential of microcomputers was clear, and attracted yet another generation of bright young hackers. Their language was BASIC, so primitive that PDP-10 partisans and Unix aficionados both considered it beneath contempt.</p>
<p>— <a href="http://www.catb.org/esr/writings/cathedral-bazaar/">The Cathedral and the Bazaar</a></p>
</blockquote>
<p>One of the biggest pressures in professional software development is the constant battle against the feeling of falling behind. Some technologists exploit this insecurity to push increasingly complex technologies to solve the challenges at hand, obfuscating the compexity behind claims of purity and correctness. The ugly truth is that a pure, correct, perfect codebase, which can only be worked on by a small fraction of the most elite developers in the world, holds almost no long-term business value. When it comes time to evolve that codebase, urgency counts. Therefore it&rsquo;s critical to balance technical purity with the wider factors in the market, such as the ability to staff projects.</p>
<p>An emerging line of thinking in the Scala community is to embrace the <em>principle of least power</em>. While advanced languages and tools such as Scala can offer a competitive advantage, they are also riddled with potential landmines because of their vast flexibility. From being used as a <em>better Java</em> to used in <em>purely functional polymorphic style</em>, the range of complexity and styles in production Scala codebases is vast.</p>
<blockquote>
<p>Given a choice of solutions, pick the least powerful solution capable of solving your problem.</p>
<p>— Li Haoyi, <a href="http://www.lihaoyi.com/post/StrategicScalaStylePrincipleofLeastPower.html">Strategic Scala Style</a></p>
</blockquote>
<p>One of the qualities that originally attracted me to the Lightbend platform was the balance between power and simplicity. The Play framework…</p>
<blockquote>
<p>Proprietary-Unix players proved so ponderous, so blind, and so inept at marketing that Microsoft was able to grab away a large part of their market with the shockingly inferior technology of its Windows operating system.</p>
</blockquote>
<p>TODO</p>
</description>
</item>
<item>
<title>The Cloud Revolution</title>
<link>http://redelastic.com/blog/the-cloud-revolution</link>
<pubDate>Tue, 06 Dec 2016 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/blog/the-cloud-revolution</guid>
<description>
<p>Server-side development is rapidly moving into the world of declarative and functional programming. Even Java 8 now supports functional programming constructs such as lambda syntax and a functional-style collections API. Libraries such as <a href="http://www.javaslang.io/">Javaslang</a> are bringing even more powerful functional programming to Java developers.</p>
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%"><span></span><span style="color: #008800; font-style: italic">/* filtering by age and converting to people to names in Java 8 with Javaslang */</span>
List&lt;String&gt; names = persons
.<span style="color: #FF0000">filter</span>(p -&gt; p.<span style="color: #FF0000">age</span> &gt; <span style="color: #0000FF">12</span>)
.<span style="color: #FF0000">map</span>(Person::getName);
</pre></div>
<p>This shift towards functional programming is not accidental.</p>
<h2 id="from-code-to-data">From Code to Data</h2>
<blockquote>
<p>When you get to where the f*** I&rsquo;m at, you gotta remind &lsquo;em about where you been.</p>
<p>— Lil Wayne</p>
</blockquote>
<p>In 2006, Ruby on Rails gave PHP developers a reasonable alternative to web development. Ruby on Rails in particular inspired a whole legion of programmers to rethink standards like the JCP and build sane frameworks rather than work within the confines of slow-moving standards designed by committee.</p>
<p>While this was happening, Amazon was quietly revolutionizing the data center.</p>
<p>Aside from Ruby on Rails, most frameworks were initially slow to catch onto the revolution happening in the cloud. Services like <a href="https://www.heroku.com/">Heroku</a> and <a href="https://aws.amazon.com/">AWS</a> began to bring unlimited resources on-tap to developers. For awhile it even looked like the JVM would lose relevance with new companies like Twitter embracing Ruby on Rails rather than the ever-complex bloatware dictated by ivory tower standards committees.</p>
<p>While on-tap resources brought tremendous flexibility to developers, they also introduced a host of situations that popular frameworks of the day were not equipped to deal with.</p>
<h2 id="the-cloud">The Cloud</h2>
<p>Let&rsquo;s be clear; the cloud is just a fancy phrase that translates to <em>”other people’s computers”</em>. When you entrust your applications to computers that you don’t own, expect the unexpected; the main issue affecting cloud architectures is that a machine in the cloud can disappear at any time and for any reason. This is the core reason why monolithic-style frameworks that hold state on the server ill-equipped as a cloud-based technology. As much as the big players like IBM and Oracle want to reposition their container-based technologies as cloud-ready, it will never happen. The reality is that a long-time ago, while Ruby on Rails was quietly embracing HTTP at the core of its offering, the Java world was attempting to graft the object model on top of HTTP and essentially hide the web from developers. Bad move.</p>
<p>Fast forward to today, and now the glue between servers — <em>the network</em> — has in many ways become more robust than servers themselves. This pushes resilience concerns off of servers and onto the glue that connects servers together. If we consider the network as the pipes, we also need a fabric that sits on top which adds context to those connections. Rather than containers, we have a fabric - what we refer to as a cluster - which needs to be managed across potentially hundreds of servers.</p>
<h2 id="resilience-in-the-cloud">Resilience in the Cloud</h2>
<p>If we don’t expect our servers to stay alive, the very least we require is that if they die they spin back up in a consistent state. This is trivial for stateless applications, but non-trivial for stateful applications.</p>
<h2 id="a-survival-guide-for-architects">A Survival Guide for Architects</h2>
<p>TODO</p>
</description>
</item>
<item>
<title></title>
<link>http://redelastic.com/home/intro/</link>
<pubDate>Thu, 17 Mar 2016 15:09:06 -0400</pubDate>
<guid>http://redelastic.com/home/intro/</guid>
<description></description>
</item>
<item>
<title>Blog</title>
<link>http://redelastic.com/blog/</link>
<pubDate>Thu, 17 Mar 2016 15:09:06 -0400</pubDate>
<guid>http://redelastic.com/blog/</guid>
<description><p>Explore some of the topics that we&rsquo;re passionate about at RedElastic.</p>
</description>
</item>
<item>
<title></title>
<link>http://redelastic.com/home/footer/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/home/footer/</guid>
<description><p>RedElastic is proudly located in downtown <strong>Toronto, Canada</strong>.</p>
<p><a href="">Schedule a chat</a></p>
<p><strong>RedElastic Inc.</strong><br>
901 King Street West, Suite 400<br>
Toronto, Ontario, Canada<br>
M5V 3H5</p>
</description>
</item>
<item>
<title></title>
<link>http://redelastic.com/home/goals/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/home/goals/</guid>
<description>
<h3 id="goals-of-your-leadership">Goals of your Leadership</h3>
<p>RedElastic is singularly focused on making the goals of your leadership a reality. We start every engagement with a number of sessions to fully map out the scope of your technical project along with long-term leadership goals. From these sessions can best advise on how to deliver solutions that fit your goals into the ever-evolving technical landscape.</p>
<h3 id="partnering-with-the-best">Partnering with the best</h3>
<p>Our extensive experience centers around partnerships, from vendors to other industry experts. Our engagements are focused on long-lasting relationships, which include helping your organization to form meaningful connections in the open source community.</p>
</description>
</item>
<item>
<title>E-commerce</title>
<link>http://redelastic.com/verticals/ecommerce/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/verticals/ecommerce/</guid>
<description><p>What if you&rsquo;re an online retailer that requires 99.9999% uptime while handling millions of page views per minute? Off-the-shelf solutions will only help you get you started, but won&rsquo;t help you deal with spikes of traffic and the other realities of doing business online.</p>
<p>The concepts of Reactive Application Development and Design (RADD) have proven themselves to drive incredible business value in e-commerce. Learn how to apply these concepts to your unique business needs.</p>
</description>
</item>
<item>
<title>Finance</title>
<link>http://redelastic.com/verticals/finance/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/verticals/finance/</guid>
<description><p>Financial services is a varied industry with many diverse needs. Balancing the availability and consistency of systems is crucial, all while maintaining an inviting and predictable user experience.</p>
<p>We can help you leverage best-in-breed technologies in the field of stream processing, big data, and reactive programming, while also preparing your leadership for the future by advising on emerging technology topics such as blockchain.</p>
</description>
</item>
<item>
<title>Introduction to the Akka framework</title>
<link>http://redelastic.com/trainings/2017-02-20/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/trainings/2017-02-20/</guid>
<description></description>
</item>
<item>
<title>Introduction to the Play framework</title>
<link>http://redelastic.com/trainings/2017-01-12/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/trainings/2017-01-12/</guid>
<description></description>
</item>
<item>
<title>Latest blog posts</title>
<link>http://redelastic.com/home/blog/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/home/blog/</guid>
<description><p>Donec id elit non mi porta gravida at eget metus. Nulla vitae elit libero, a pharetra augue. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Curabitur blandit tempus porttitor.</p>
</description>
</item>
<item>
<title>Public training</title>
<link>http://redelastic.com/home/trainings/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://redelastic.com/home/trainings/</guid>
<description><p>Donec ullamcorper nulla non metus auctor fringilla. Donec sed odio dui. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
</description>
</item>
</channel>
</rss>