F# was used to build game infrastructure and logic for a company serving millions of users daily. Some key benefits of F# included:
1) Domain modeling using discriminated unions, types, and measures helped increase correctness and productivity.
2) An actor model with asynchronous message passing was used to build stateful game servers in a scalable and efficient way without locks.
3) Processing game events as immutable facts allowed different systems to process specific facts independently and flexibly.
In this talk we discussed a number of real world use cases of F# at Gamesys for domain modelling, async programming, writing game logic & genetic algorithms, and creating DSLs to tame complexities with AWS APIs.
In this talk, I discussed the different forms of complexities that can arise when integrating with APIs, and how DSLs can be used to tackle these complexities. I demonstrated that F# can be a very effective tool for creating both internal and external DSLs using both FParsec and active patterns.
A few techniques for everyday Ruby hacking
Touching on the following topics:
DRY Assignment
Ternary operator
Bang bang
Conditional assignment
Parallel assignment
Multiple return
Implied begin
Exception lists
Symbol to Proc
MapReduce
Regex captures
tap
sprintf
case equality
Splat Array
Splat args
blank?
present?
presence
truncate
try
in?
Delegation
delegate
Memoization
memoize
alias_method_chain
class_attribute
HashWithIndifferentAccess
In this talk we discussed a number of real world use cases of F# at Gamesys for domain modelling, async programming, writing game logic & genetic algorithms, and creating DSLs to tame complexities with AWS APIs.
In this talk, I discussed the different forms of complexities that can arise when integrating with APIs, and how DSLs can be used to tackle these complexities. I demonstrated that F# can be a very effective tool for creating both internal and external DSLs using both FParsec and active patterns.
A few techniques for everyday Ruby hacking
Touching on the following topics:
DRY Assignment
Ternary operator
Bang bang
Conditional assignment
Parallel assignment
Multiple return
Implied begin
Exception lists
Symbol to Proc
MapReduce
Regex captures
tap
sprintf
case equality
Splat Array
Splat args
blank?
present?
presence
truncate
try
in?
Delegation
delegate
Memoization
memoize
alias_method_chain
class_attribute
HashWithIndifferentAccess
Taking Perl to Eleven with Higher-Order FunctionsDavid Golden
Sometimes, you just need your Perl to go one higher. This talk will teach you how to use functions that return functions for powerful, succinct solutions to some repetitive coding problems. Along the way, you’ll see concrete examples using higher-order Perl to generate declarative, structured “fake” data for testing.
In this talk I discussed the various ways in which we utilise Neo4j and data modelling with graphs to helps us model and automate the complex in-game economy in our MMORPG title Here Be Monsters.
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
Query performance should be the unsung hero of an application, but without proper configuration, can become a constant headache. When used properly, MongoDB provides extremely powerful querying capabilities. In this session, we'll discuss concepts like equality, sort, range, managing query predicates versus sequential predicates, and best practices to building multikey indexes.
F# in social gaming by Yan Cui at Codemotion DubaiCodemotion Dubai
F# is an incredibly versatile and expressive language and enables you to solve a wide array of problems succinctly and efficiently. This talk illustrates, with real-world examples, how the Gamesys social team is using F# to build the backend services that support around 1 million Daily Active Users (DAU) and 250 million daily requests across its social games on both mobile and web platforms.
Event sourcing and Domain Driven Design are techniques that allow you to model your business more truthfully - by expressing it via commands, events and aggregates etc. The new akka-persistence module, included in Akka since the 2.3 release is aimed at easing implementing event sourced applications. Turns out the actor model and events as messages fit in here perfectly. During this session we'll discover how to build reactive, event sourcing based apps using the new abstractions provided, and investigate how to implement your own journals to back these persistent event sourced actors.
Akka persistence == event sourcing in 30 minutesKonrad Malawski
Akka 2.3 introduces akka-persistence, a wonderful way of implementing event-sourced applications. Let's give it a shot and see how DDD and Akka are a match made in heaven :-)
Casting for not so strange Actos
- A presentation about the Actors pattern and a look at prototypes in 4 different programming languages - Jruby (Celluloid), Erlang, Elixir and Scala (Akka)
- Presented in "Strange Group Berlin" meetup on 12.03.2015 held at 6Wunderkinder
A dive into Graham Hutton's "Higher Order Functions for Parsing", which appeared in the Journal of Functional Programming in 19992.
All the techniques have been worked through in Haskell.
Turn Hours into Seconds - Concurrent event processing in Elixir using FlowEmil Soman
For programmers who have been using locks for synchronizing threads to solve all concurrency problems, embracing message passing and creating concurrent data flows is an enlightening experience. This talk is a case study of a real world concurrency problem where the developer started with a slow non-thread-safe solution and refactored it step by step into a fast yet simple concurrent solution making use of Elixir's concurrent computation library called Flow.
RubyConf Portugal 2014 - Why ruby must go!Gautam Rege
In this talk, I take the audience through ha whirlwind tour of Golang for Rubyists. I also discuss things like "Programmer Awareness", what can Rubyists learn from Go and how they can co-exist.
When building mobile applications performance is really crucial. If we compare React for web development with React-Native, the latter is much more restrictive in the sense that performance mistakes are sometimes far more reaching, even taking into account the golden quote of Donald Knuth “premature optimization is the root of all evil”. This talk is going to provide a deeper dive into principles and practices of making sure your app behaves as fast as possible. We will look at the common mistakes of component design, which lead to performance degradation. How to make lists more performant and animations more fluid. I will also introduce some of the tools, which might help you discover bottlenecks in your application.
Replacing `import` with `accio`! Compiling Pythons with Custom Grammar for the sake of a joke!
In Python, overwriting builtin functions is fairly easy. You can even do it in the interpreter! But can you overwrite a statement, like import, just as easily? Let's go on an adventure, discovering how the import statement works, and how Python statements are defined in the CPython source code. We'll face some consequences of bootstrapping, and, to get our custom Harry Potter-themed Grammar to work, we'll have to compile a Python to compile a Python.
Taking Perl to Eleven with Higher-Order FunctionsDavid Golden
Sometimes, you just need your Perl to go one higher. This talk will teach you how to use functions that return functions for powerful, succinct solutions to some repetitive coding problems. Along the way, you’ll see concrete examples using higher-order Perl to generate declarative, structured “fake” data for testing.
In this talk I discussed the various ways in which we utilise Neo4j and data modelling with graphs to helps us model and automate the complex in-game economy in our MMORPG title Here Be Monsters.
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
Query performance should be the unsung hero of an application, but without proper configuration, can become a constant headache. When used properly, MongoDB provides extremely powerful querying capabilities. In this session, we'll discuss concepts like equality, sort, range, managing query predicates versus sequential predicates, and best practices to building multikey indexes.
F# in social gaming by Yan Cui at Codemotion DubaiCodemotion Dubai
F# is an incredibly versatile and expressive language and enables you to solve a wide array of problems succinctly and efficiently. This talk illustrates, with real-world examples, how the Gamesys social team is using F# to build the backend services that support around 1 million Daily Active Users (DAU) and 250 million daily requests across its social games on both mobile and web platforms.
Event sourcing and Domain Driven Design are techniques that allow you to model your business more truthfully - by expressing it via commands, events and aggregates etc. The new akka-persistence module, included in Akka since the 2.3 release is aimed at easing implementing event sourced applications. Turns out the actor model and events as messages fit in here perfectly. During this session we'll discover how to build reactive, event sourcing based apps using the new abstractions provided, and investigate how to implement your own journals to back these persistent event sourced actors.
Akka persistence == event sourcing in 30 minutesKonrad Malawski
Akka 2.3 introduces akka-persistence, a wonderful way of implementing event-sourced applications. Let's give it a shot and see how DDD and Akka are a match made in heaven :-)
Casting for not so strange Actos
- A presentation about the Actors pattern and a look at prototypes in 4 different programming languages - Jruby (Celluloid), Erlang, Elixir and Scala (Akka)
- Presented in "Strange Group Berlin" meetup on 12.03.2015 held at 6Wunderkinder
A dive into Graham Hutton's "Higher Order Functions for Parsing", which appeared in the Journal of Functional Programming in 19992.
All the techniques have been worked through in Haskell.
Turn Hours into Seconds - Concurrent event processing in Elixir using FlowEmil Soman
For programmers who have been using locks for synchronizing threads to solve all concurrency problems, embracing message passing and creating concurrent data flows is an enlightening experience. This talk is a case study of a real world concurrency problem where the developer started with a slow non-thread-safe solution and refactored it step by step into a fast yet simple concurrent solution making use of Elixir's concurrent computation library called Flow.
RubyConf Portugal 2014 - Why ruby must go!Gautam Rege
In this talk, I take the audience through ha whirlwind tour of Golang for Rubyists. I also discuss things like "Programmer Awareness", what can Rubyists learn from Go and how they can co-exist.
When building mobile applications performance is really crucial. If we compare React for web development with React-Native, the latter is much more restrictive in the sense that performance mistakes are sometimes far more reaching, even taking into account the golden quote of Donald Knuth “premature optimization is the root of all evil”. This talk is going to provide a deeper dive into principles and practices of making sure your app behaves as fast as possible. We will look at the common mistakes of component design, which lead to performance degradation. How to make lists more performant and animations more fluid. I will also introduce some of the tools, which might help you discover bottlenecks in your application.
Replacing `import` with `accio`! Compiling Pythons with Custom Grammar for the sake of a joke!
In Python, overwriting builtin functions is fairly easy. You can even do it in the interpreter! But can you overwrite a statement, like import, just as easily? Let's go on an adventure, discovering how the import statement works, and how Python statements are defined in the CPython source code. We'll face some consequences of bootstrapping, and, to get our custom Harry Potter-themed Grammar to work, we'll have to compile a Python to compile a Python.
Implementing Server Side Data Synchronization for Mobile AppsMichele Orselli
Today mobile apps are everywhere. These apps cannot count on a reliable and constant internet connection: working in offline mode is becoming a common pattern. This is quite easy for read-only apps but it becomes rapidly tricky for apps that create data in offline mode. This talk is a case study about a possible architecture for enabling data synchronization in these situations
Distributed Consensus A.K.A. "What do we eat for lunch?"Konrad Malawski
Distributed Consensus is everywhere! Even if not obvious at first, most apps nowadays are distributed systems, and these sometimes have to "agree on a value", this is where consensus algorithms come in. In this session we'll look at the general problem and solve a few example cases using the RAFT algorithm implemented using Akka's Actor and Cluster modules.
Delivered at the Serverless Summit 2022. Learn how to design serverless systems and tip the balance of trade-offs in your favour.
To learn how to build production-grade serverless applications, check out my upcoming workshops at productionreadyserverless.com and get 15% off with the code "serverlesssummit22".
At the heart of every event-driven architecture is a conduit for messages to flow through. AWS offers many services that can act as such conduit - EventBridge, SNS, SQS, Kinesis, DynamoDB streams, MSK, IOT Core and Amazon MQ just to name a few! These services have different characteristics and trade-offs around performance, scalability and cost. Picking the right service for your workload is not always easy. In this talk, let’s talk about how to pick the right messaging service to use in your event-driven architecture and play the game of trade-offs to your advantage.
How to choose the right messaging service for your workloadYan Cui
At the heart of every event-driven architecture is a conduit for messages to flow through. AWS offers many services that can act as such conduit - EventBridge, SNS, SQS, Kinesis, DynamoDB streams, MSK, IOT Core and Amazon MQ just to name a few! These services have different characteristics and trade-offs around performance, scalability and cost. Picking the right service for your workload is not always easy. In this talk, let’s talk about how to pick the right messaging service to use in your event-driven architecture and play the game of trade-offs to your advantage.
Patterns and practices for building resilient serverless applications.pdfYan Cui
Lambda gives you multi-AZ out-of-the-box, but still, things can go wrong in production. There are region-wide outages, and performance degradation in services your function depends on can cause it to time out or error. And what if you're dealing with downstream systems that just aren't as scalable and can't handle the load you put on them? The bottom line is many things can go wrong and they often do at the worst of times. The goal of building resilient systems is not to prevent failures, but to build systems that can withstand these failures. In this talk, we will look at a number of practices and architectural patterns that can help you build more resilient serverless applications. Such as multi-region, active-active, employing DLQs and surge queues. We'll also see how we can use chaos experiments to help us identify failure modes before they manifest in production.
Serverless observability - a hero's perspectiveYan Cui
Yan Cui, an AWS Serverless Hero, will talk about the learnings from using serverless at scale.
He will cover the challenges for observability in serverless asynchronous workloads and the patterns to address those challenges, like using centralized logging, correlation IDs, tracing, lambda extensions.
How to ship customer value faster with step functionsYan Cui
Learn all about AWS Step Functions and how to use them to model business workflows and ship customer values quickly. In this session, we will talk about what is Step Functions, how to model business workflows as state machines, real-world case studies, and design patterns. By the end of this webinar, you should have a good idea of where Step Functions fit into your application and why you should use them (and why not!) to model workflows instead of building a custom solution yourself.
One of the key characteristics of serverless components is the pay-per-use pricing model. For example, with AWS Lambda, you don’t pay for the uptime of the underlying infrastructure but for the no. of invocations and how long your code actually runs for.
This important characteristic removes the need for many premature micro-optimizations as your cost is always tightly linked to usage and minimizes waste. As a result, many applications would run at a fraction of the cost if they were moved to serverless.
The pay-per-use pricing model also enables more accurate cost prediction and monitoring based on your application’s throughput. This gives rise to the notion of FinDev, where finance and development can intersect and allows optimization to be targeted to give the optimal return-on-invest on the engineering efforts.
And by building your application on serverless components, you can also leverage it as a business advantage and offer a more competitive, usage-based pricing to your customers. Which is going to be crucial at a time when businesses all around the world are affected by COVID and are looking for better efficiencies.
In this webinar, we will cover topics such as:
- How does the cost of serverless differ from serverful applications?
- How to predict and monitor cost in serverless applications?
- When should you optimize for cost?
- How can you leverage usage-based pricing as a business advantage?
Why your next serverless project should use AWS AppSyncYan Cui
In this webinar, Yan Cui and Lumigo Software Engineer Guy Moses will discuss some of the power of GraphQL and AppSync and why AppSync + Lambda + DynamoDB should be your stack of choice in 2021 and beyond!
Serverless technologies drastically simplify the task of building modern, scalable APIs in the cloud, and GraphQL makes it easy for frontend teams to consume these APIs and to iterate quickly on your product idea. Together, they are a perfect combination for a product-focused, full-stack team to deliver customer values quickly.
In this talk, see how we built a new social network mobile app in under 4 weeks using Lambda, AppSync, DynamoDB and Algolia. How we approached CI/CD, testing, authentication and lessons we learnt along the way.
Real-world serverless podcast: https://realworldserverless.com
Learn Lambda best practices: https://lambdabestpractice.com
Blog: https://theburningmonk.com
Consulting services: https://theburningmonk.com/hire-me
Production-Ready Serverless workshop: https://productionreadyserverless.com
Patterns and practices for building resilient serverless applicationsYan Cui
Lambda gives you multi-AZ out-of-the-box, but still, things can go wrong in production. There are region-wide outages, and performance degradation in services your function depends on can cause it to time out or error. And what if you're dealing with downstream systems that just aren't as scalable and can't handle the load you put on them? The bottom line is many things can go wrong and they often do at the worst of times. The goal of building resilient systems is not to prevent failures, but to build systems that can withstand these failures. In this talk, we will look at a number of practices and architectural patterns that can help you build more resilient serverless applications. Such as multi-region, active-active, employing DLQs and surge queues. We'll also see how we can use chaos experiments to help us identify failure modes before they manifest in production
How to bring chaos engineering to serverlessYan Cui
You might have heard about chaos engineering in the context of Netflix and Amazon, and how they kill EC2 servers in production at random to verify that their systems can stay up in the face of infrastructure failures. But did you know that the same ideas can be applied to serverless applications? Yes, despite not having access to the underlying servers, we can still apply principles of chaos engineering to uncover failure modes in our system (and there are plenty!) so we can build a defence against them and make our serverless applications more robust and more resilient!
Migrating existing monolith to serverless in 8 stepsYan Cui
Refactoring a monolith to serverless can be intimidating, but there are discrete steps that you can take to simplify the process. In this talk, AWS Serverless Hero Yan Cui outlines 8 steps to successfully refactor your monolith and highlight key decision points such as language and tooling choices.
Building a social network in under 4 weeks with Serverless and GraphQLYan Cui
Serverless technologies drastically simplify the task of building modern, scalable APIs in the cloud, and GraphQL makes it easy for frontend teams to consume these APIs and to iterate quickly on your product idea. Together, they are a perfect combination for a product-focused, full-stack team to deliver customer values quickly.
In this talk, see how we built a new social network mobile app in under 4 weeks using Lambda, AppSync, DynamoDB and Algolia. How we approached CI/CD, testing, authentication and lessons we learnt along the way.
Real-world serverless podcast: https://realworldserverless.com
Learn Lambda best practices: https://lambdabestpractice.com
Blog: https://theburningmonk.com
Consulting services: https://theburningmonk.com/hire-me
Production-Ready Serverless workshop: https://productionreadyserverless.com
FinDev as a business advantage in the post covid19 economyYan Cui
The impact COVID19 has had on consumer economy, ripples out to other service providers - analytics tools, etc because everyone is going to be squeezed. And the variable-cost (or pay-as-you-use) pricing model will be more appealing as companies tighten up their budgets for non-essential services/tools.
AWS has improved Lambda cold starts by leaps and bounds in the last year. But for performance-sensitive applications such as user-facing APIs, Lambda cold starts are still a thorn in one’s side, especially when working with languages such as Java and .Net Core.
In this webinar, we will dive into strategies for improving cold start latency and how to mitigate them altogether with Provisioned Concurrency, and how Lumigo helps you optimize your use of Provisioned Concurrency.
In this session, we will look at 10 common use cases for AWS Lambda such as REST APIs, WebSockets, IoT and building event-driven systems. We will also touch on some of the latest platform features such as Provisioned Concurrency, EFS integration and Lambda Destinations and when and where we should use them.
A chaos experiment a day, keeping the outage awayYan Cui
Presented at ServerlessDays Warsaw
Recording: https://youtu.be/21HprKZQczs
You might have heard about chaos engineering in the context of Netflix and Amazon, and how they kill EC2 servers in production at random to verify that their systems can stay up in the face of infrastructure failures. But did you know that the same ideas can be applied to serverless applications? Yes, despite not having access to the underlying servers, we can still apply principles of chaos engineering to uncover failure modes in our system (and there are plenty!) so we can build defence against them and make our serverless applications more robust and more resilient!
One of the most common performance issues in serverless architectures is elevated latencies from external services, such as DynamoDB, ElasticSearch or Stripe.
In this webinar, we will show you how to quickly identify and debug these problems, and some best practices for dealing with poor performing 3rd party services.
17. • Line Win!
– X number of matching symbols on adjacent columns!
– Positions have to be a ‘line’!
– Wild symbols substitute for other symbols!
!
• Scatter Win!
– X number of matching symbols anywhere!
– Triggers bonus game
18. What symbols should land?!
Any special symbol wins?!
Did the player win anything?
22. type Symbol = Standard! of string!
! ! ! | Wild
e.g.! Standard “hat”!
! Standard “shoe”!
! Standard “bonus”!
! …
23. type Symbol = Standard! of string!
! ! ! | Wild
i.e.! Wild
24. !
!
!
type Win = LineWin of int * Symbol * int!
! | ScatterWin of Symbol * int
25. !
!
!
type Win = LineWin of int * Symbol * int!
! | ScatterWin of Symbol * int
e.g.! LineWin (5, Standard “shoe”, 4)
26. !
!
!
type Win = LineWin of int * Symbol * int!
! | ScatterWin of Symbol * int
e.g.! ScatterWin (Standard “bonus”, 3)
27. type LineNum = int!
type Count! = int!
!
type Win = LineWin of LineNum * Symbol * Count!
! | ScatterWin of Symbol * Count
28. type LineNum = int!
type Count! = int!
!
type Win = LineWin of LineNum * Symbol * Count!
! | ScatterWin of Symbol * Count
e.g.! LineWin (5, Standard “shoe”, 4)
29. type LineNum = int!
type Count! = int!
!
type Win = LineWin of LineNum * Symbol * Count!
! | ScatterWin of Symbol * Count
e.g.! ScatterWin (Standard “bonus”, 3)
56. The Actor Model
An actor is the fundamental unit of computation
which embodies the 3 things!
• Processing!
• Storage!
• Communication!
that are essential to computation.!
!
-Carl Hewitt*
* http://bit.ly/HoNHbG
57. The Actor Model
• Everything is an actor!
• An actor has a mailbox!
• When an actor receives a message it can:!
– Create new actors!
– Send messages to actors!
– Designate how to handle the next message
58. Stateful Server
• Gatekeeper!
– Manages the local list of active workers!
– Spawns new workers!
!
• Worker!
– Manages the states for a player!
– Optimistic locking!
– Persist state after period of inactivity
68. type Result<‘T> =!
| Success! of ’T!
| Failure! of Exception!
!
type GetResult = Result<State * Version>!
type PutResult = Result<unit>!
69. type Agent<‘T> = MailboxProcessor<‘T>!
!
type Message = !
| Get of AsyncReplyChannel<GetResult>!
| Put of State * Version * AsyncReplyChannel<PutResult>
70. type Agent<‘T> = MailboxProcessor<‘T>!
!
type Message = !
| Get of AsyncReplyChannel<GetResult>!
| Put of State * Version * AsyncReplyChannel<PutResult>
71. type Worker (playerId) =!
let agent = Agent<Message>.Start(fun inbox ->!
let state = getCurrentState playerId!
!
let rec workingState (state, version) = !
async { … }!
and closedState () =!
async { … }!
!
workingState (state, 1))
72. type Worker (playerId) =!
let agent = Agent<Message>.Start(fun inbox ->!
let state = getCurrentState playerId!
!
let rec workingState (state, version) = !
async { … }!
and closedState () =!
async { … }!
!
workingState (state, 1))
73. type Worker (playerId) =!
let agent = Agent<Message>.Start(fun inbox ->!
let state = getCurrentState playerId!
!
let rec workingState (state, version) = !
async { … }!
and closedState () =!
async { … }!
!
workingState (state, 1))
74. type Worker (playerId) =!
let agent = Agent<Message>.Start(fun inbox ->!
let state = getCurrentState playerId!
!
let rec workingState (state, version) = !
async { … }!
and closedState () =!
async { … }!
!
workingState (state, 1))
75. type Worker (playerId) =!
let agent = Agent<Message>.Start(fun inbox ->!
let state = getCurrentState playerId!
!
let rec workingState (state, version) = !
async { … }!
and closedState () =!
async { … }!
!
workingState (state, 1))
218. SELECT * FROM GameScore
Abstract Syntax Tree (AST)
FParsec
219.
220. select GameTitle, UserId, TopScore
from GameScores
where GameTitle = “Starship X”
and TopScore >= 1000
order desc
limit 3
with (NoConsistentRead, Index(GameTitleIndex, true))
226. a long time ago, in a language
far far away from .Net - Erlang.
there was an idea to let you
pattern match again binary
payloads and work with them
at a bit level…