Jan Filipowski

Lightning Talks - Day 1

wroc_love.rb 2017

00:00:11.770 First of all, I would like to thank you for the chance to speak here to all of you. My name is Damian Legawiec, and I am from Spark Solutions, an e-commerce software agency based in Warsaw, Poland. We work with clients such as the PayPal Group, Gwyneth Paltrow's website, and various other clients, mostly in e-commerce from the US and the UK. Currently, we have about 44 people on our team. Besides client work, we also invest heavily in open-source projects. Our crowning achievement in open-source is Spree Commerce, which I hope some of you have heard of. Spree is a robust e-commerce framework and one of the largest open-source projects on GitHub, boasting about 700 contributors. It's a modular, API-driven e-commerce framework, which we prefer to call it, not just a commerce platform like Magento. Spree also has a large number of extensions and operates over a thousand stores worldwide. It's a well-established project, around seven years old, and we began maintaining it last year. This is our story of how we got it up and running.
00:01:10.090 In the real world, Spree is utilized by companies like GoDaddy. As I mentioned earlier, Gwyneth Paltrow's website is a huge platform with around three million visitors per month, and Casper is one of the hottest startups right now selling mattresses. Bonobos is a prominent clothing website in the US, and our other projects include Milan Stein, a significant fashion e-commerce marketplace in the UK, and Critical, which sells thousands of products daily, primarily in the US and Canada. Today, we are also excited to announce the release of Spree 3.2, which includes support for Rails 5. We have also streamlined the process of using extensions for those of you who have experience with Spree in the past. Maintaining extensions has been challenging, and we are currently working to make it easier.
00:02:08.500 Any project starting from Spree 3.1 will use universal extensions, ensuring compatibility with future versions of Spree, including Rails 4.2 and Rails 5.1 upon its release. Those are just some highlights from the Spree 3.0 release. You can easily install it from RubyGems. In terms of support, we will maintain the order profession for about two years following the initial release, as it is quite popular among our clients who use it daily. Before we formally release Spree 3.2 and all its features, we implemented it for two of our clients internally to test and develop it, ensuring that it is stable.
00:03:06.260 As you can see from the previous slide, there is a release candidate for Rails 5. It's currently in its third release candidate stage, but especially for Wrocław, we are releasing it live today. Let's hope the network is running smoothly.
00:03:36.720 It's crucial to remember that the modular aspect of Spree is not just a marketing buzzword. To utilize Spree, you will need to install several gems. Thank you for your attention. By the way, there are some stickers for Spree 3.2 available if you'd like to grab one. Now, I want to shift gears and talk about Rails and Ruby. Ruby is considered fast enough for general purposes, and I’d like to share some tips with you on how to build efficient APIs using Ruby on Rails. We will explore some benchmarks and discuss ways to enhance speed even further. Firstly, only load the things you really need. Rails 5 has an API mode, but there are instances where you can skip unnecessary parts.
00:05:04.200 Next, if you are using JSON API resources, avoid inheriting from the controller provided by Rails. Instead, use the JSON API resource controller. It is much lighter. If you have a listing that needs to include certain modules, consider creating a view in the database to reduce the number of Active Record instances. Database views are typically the best way to optimize performance. I was able to test a very simple endpoint that returned just a few records in a benchmarking exercise. I conducted it on a single core process, sending 10,000 requests, and the results showed that I achieved approximately 250 requests per second, with the average time per request being around 4 milliseconds.
00:06:11.600 If 4 milliseconds per request seems excessive for your needs, there are alternatives. For instance, consider rewriting in a newer framework that just appeared on NPM, or implementing a reverse proxy to manage heavily loaded endpoints. During my testing, I rewrote this application in Ruby using Sinatra, yielding quite remarkable results. It only required about 70 lines of Ruby to achieve this, leading to significantly higher stability and performance in the requests.
00:06:51.920 In repeating the benchmarks, I observed that we could handle three times more requests per second, with a noticeable reduction in waiting time down to about 1.3 milliseconds per request. This performance boost is an impressive feat. Before I conclude, I want to encourage you all to consider the value of the model in your applications. Typically, we associate models with active record objects in our Rails applications. However, a model can refer to various entities, value objects, and services. Understanding this broader aspect of models opens the floor to creative ways of solving problems in software.
00:08:16.640 Models can also represent processes in economic terms where variables interact. However, it’s essential to control these models because many mainstream economic models may overlook significant events due to neglecting low probabilities of critical failures. Similarly, scientific models attempt to predict real-world phenomena through various frameworks. Always remember that models should remain relevant, functional, and adaptable. If a model becomes too abstract or inflexible, it loses its effectiveness, and if it’s too closely tied to reality, it can become difficult to manage.
00:09:46.270 In light of that, it’s crucial to keep your models balanced and not overly complicated. Maintaining simplicity while thinking critically about your domain will lead to better outcomes. I hope this encourages everyone to reflect on their practices and potential improvements. Thank you very much.
00:12:10.279 Hello, I'm Bartosz, and like many of you, I’m a Ruby developer. I often feel shy and stressed while speaking, but I want to share my passion for learning. Lately, the means of learning have shifted for me. Previously, I used to rely on meetups and conferences, which can be both expensive and infrequent. Traditional books have become less favorable, as they are often not as useful for our current needs. Blogging platforms have emerged as a popular medium; how many of you here maintain a blog? Vlogs and screencasts are also becoming significant ways of sharing knowledge.
00:13:09.640 Recently, a new trend has emerged—podcasts, which have been around since approximately 2004 yet are still gaining traction. How many of you listen to podcasts? Awesome! Podcasts are easy to consume on the go, thanks to our smartphones acting as excellent podcast players. The loyalty of podcast listeners is also remarkable; they often engage with all episodes and provide constructive feedback. The community has been growing since 2010, resulting in more high-quality content. Therefore, I would like to recommend several podcasts I think you should check out: 'Ruby Rogues' has around 300 episodes available since 2011, offering concise talks about Ruby. Also, 'Ruby on Rails podcast' is another fantastic resource, as is 'The Thoughtbot Podcast,' which is entertaining and informative.
00:14:49.910 So these are a few recommendations, and I hope you'll give them a chance!
00:17:06.640 My name is Piotr, and I work at Labor Voices, where we help workers in garment factories in Turkey and Bangladesh to report their working conditions. We sell this data to clothing brands, and about a year ago, we began developing a subscription product called Symphony. I was eager to create a distributed system with the ability to authenticate across multiple systems, but I found it challenging. I came across services like Auth0 and Stormpath that simplify this process immensely. After using them for a year, I realized the benefits they bring over managing your own identity store and dealing with security risks like data breaches. JSON Web Tokens (JWT) are a crucial part of this, providing a straightforward way to manage authentication across applications, allowing a single client ID to serve multiple APIs, and alleviating many concerns associated with identity management.
00:22:28.870 Utilizing Auth0 lets your applications communicate securely, separating client and internal user databases while providing significant control over user management. This allows you to isolate internal systems from user accounts exposed to public interfaces, thus enhancing security. I recommend exploring Auth0 as a robust solution for managing user identity securely. Thank you!
00:24:11.890 Now, I’ll conclude with a bit more low-tech advice. I'm from Germany, and I want to address the Rails logs. They often need more clarity. I've created a simple gem that enhances logging by adding additional context. This gem is available on GitHub. Thank you for your time!