 Perfect So I'm here to talk about engineer and I'm gonna do that for about five minutes, and then I'm gonna do some code so Scary risky code, so I just want to sort of go over what engineer does I'm pretty sure you guys mostly know but I'll get you off the date in case you don't we have Hosting company for one thing which is focuses on deployment So we do we have done for a bunch of years basically deployment assistance through our hardware hosting company We have we do everything right now from a couple of slides or slice all the way up to full cluster Slice basically means you get a slice of our infrastructure and that includes slice of database a slice of hard hard drive Pretty much a slice of the entire infrastructure and a slice of support That's the hardware offering. We just announced something called solo which really what I want to talk about Which is basically fully automating what we've already done what we've learned from the hardware offering AWS so basically you go on There's a screencast online that you can look at for more details But the bottom line is you go on you specify your git repository your svm repository you specify your specify your gems and You specify your units dependencies all that you click go five to ten minutes later You have the site that's up and running it's accessible over the internet. So that's pretty much awesome It's the only AWS based offering I know of them has that level of integration with rails and it's based on the fact that we've been doing it Person-to-person for a bunch of years now So at this point we pretty much know what it takes to get a rails app up and running and what sort of the 8020 rule is and Trying to push it more towards 9010 with getting rails apps up and running. That's why we include things like unique dependencies and Pretty much you can just get up and running very quickly and you should check it out There's a screencast like I said or you can you know sign up try it out Definitely worth it on the other side of the business. We do a bunch of open-source stuff. So probably know I worked on Merb for a Year ish just now merged into rails. I don't really have to say more about that topic other than the fact that I'm working full-time on rails now and Engine yard is putting another resource on rails Sometime in March, so we'll have to full-time people working on rails by the end of March It's pretty cool And then we also have a couple other projects one called vertebra, which is still in it's pretty early stage And we just released as open-source basically it's a cloud computing platform So the goal is to make it so that you can put all a bunch of stuff in the cloud gets it's agnostic to what is To what's going on so you can say you can have one node say anybody who is of this customer Restart your slice or you can say anybody who's able to decode FLV video Go decode or one of you guys basically the idea is to remove out the idea of end points So you don't have to know which server actually does something you the servers broadcast their capabilities Effectively and then any other server can make requests of the servers by capability And there's a whole bunch of other stuff like workflow management and security and it's all open-source. You should check it out It's pretty cool. It's based on Erlang Stephanie still very early like I said, but we it's Moving moving on far enough that we felt comfortable open-sourcing it and people are playing with it. It's cool stuff and We also have the other thing is a Y express which is basically a VMware image of our hosting environment So it's mainly designed for people who are actually our hosting platform to be able to have an image that is exactly like our Hosting environment locally, but it could also be used in general in that it will get you up and running with rails or more Very quickly because it's a ready VMware image that has everything installed So and and you can always refresh it you can pretty much delete it and start from scratch whenever you want It's a clean environment. That is the same environment that we install on our servers. That's pretty cool So that's engineered I wanted to show you a little bit about what I've been working on which is rails But I'm going to give you a simple example of something I can I'm going to do some dangerous live coding here During a vendor talk It's crazy Mainly because there's no other way to really explain this without just showing it so I'm going to show you is basically what I've been working on in rails with the callback system, which basically takes the old callback system, which was very Very slow and very simplistic and converted to a much faster co-generated beast So I'll do it by a simple example here So here I am. I don't know if you let me make it much bigger so Is that readable? Okay, so basically callbacks are this a simple concept You have a class you say include callbacks then you could define a callback This is basically how active records callbacks work internally. You say I want to save callback Then you could define one on this case of I'm defining to one That's a symbol which basically means call that symbol you're probably familiar for this from before filters and then another one That's a proc just basically Do something which is effectively the same Then I'm making an initializer which sets up a history instance variable and then I'm just manipulating it so that through tasks will be able to see that the callbacks were actually called and Then insane. I'm just saying one callback save Right So let's write a quick test that basically just shows that that happens. So I have my class so do my class so you know club object equals my class new and object that save and object history should equal and I think method and Obviously, I haven't written any code yet. So this is not gonna work. It's pretty easy to write the code that makes this work out We want to make something called save callback here. So let's just By the way, this is a cool trick here If you use intense mate Ruby eval it'll actually continue syntax highlighting or anything with Ruby in it Continue syntax highlighting inside So we want to make something called so we're defining callback with a name. So we want to do name Callback And it will take something an object So we'll make a simple callback chain. So let's say so we're gonna set up basically we're gonna have a list of callbacks and It should be already close actually So what we have what we've done here just to recap is When you say to find callback with a name, we're gonna make a method called that name callback and if you go back here, right, we said to find callback save and now we have safe callback and It takes an object and all we're doing here is we're Making sure that that in an instance variable with the name callbacks exist and then we're pushing the object onto the staff and Then we also need to make the run callbacks method, right? Actually, this needs to be self-taught Actually, we need to do this a little bit differently So we need to do a typical Know if people have seen this idiom before sorry So this is actually a standard Ruby idiom here, which basically allows you to take a module and Have that module basically be inherited from so here we have a class up to be module callbacks Right here We have a module called callbacks and what we want to do actually is we want to have both class methods and instance level methods that get included so if you go back over here, you'll see that Define callback is on the class itself, but run callbacks is on the instance and When you include from a module in Ruby that module actually only will include the instance methods that are defined So here what we're doing is it's a standard even if you don't know it. You should look it up and learn it awesome Basically, we're just saying if you get included into Extend these other methods these class methods which basically means that defined callback is going to be available on the class level So now we should go back to including callbacks and we can just define the run Right here. Okay, so now Assuming everything went well here and actually we shouldn't have to do that Just do everything well here. We'll find out when we run the test in a second We have what we have where we're gonna have when we run callbacks is this list of callbacks that we Added via the callback method and we want to check to see what it is now, right? So if it's If it's a symbol Then just send it. It's a proc then you want to do The case callback right you want to call into it. Let's see if this works probably not Yes This line Well something else went wrong and find local variable. Oh, that's the reason I'm the fine method save callback So where's that coming from callbacks back line seven? Let's see if we can get this working before I'm out of time So we have undefined method save callback for my class So we are doing we're creating it here, right name So we should be defining one it's definitely getting called So I'm actually out of time sadly So are there more lightning talks today? Because I will finish it and show it that anyway I'll explain basically assuming this works what the next steps are and one and a half minutes Which is basically once this works. This is a very simple way What sucks about this technique over here is that what ends up happening is that? This iteration over here this run callbacks has to actually go through the whole callback list every time That's to do this case statement Which actually is quite slow especially when you start getting a longer list of callbacks and was quite extraordinary Is that actually as I looked at this what was going on? It was actually like 20% of our world was just spent in various callbacks throughout the system So that was crazy. The technique is basically to do the same Class eval over here and define a special method So that is the one callback method that contains the iteration So instead of saying, you know one symbol one proc basically do Basically have a method called something like internally called like run save callbacks Which does effectively save and then Let's say the proc. I'll call self So this it ends up being that method is what ends up getting brought internally instead of that iteration And that's obviously much faster. So that's what I've been doing and Been integrating it with rails in general and that should help bring down that overhead from like 20% to 1% ish Yeah, I'm gonna make this actually work a okay, and then post it or something sweet