There's Shady What's going on everybody cut Kyle and Shawn here relating sports guys were in one box for a Paul B It's gonna be Star Wars Masterwork. Good luck. Mr. Paul and Merry Christmas my man the battle of the Shady's The Shady's always going out. I love it toe-to-toe Shady, I absolutely love it man. Can't get enough of it The Shady Wars love it. Let's go Paul. Good luck Paul Do it my man. Let's see a sketch for you, sir Big auto basically Museum Star Wars. It's very similar and the box is set up The Shady Wars man, that one came out of nowhere to your left. You'll love it What's going on Shady? Yeah, there's two Shady's they compete for the real shadiness Real slim there's a Yoda and blue is not numbered magistrate Morgan L's Beth That was Beth Magistrate Omega and that'll be Ig 88 to 299 to 299. Uh-oh The Shady's not gonna like that Ig 88 and I got a ray on the jersey there source fabric relic Source fabric relic you have. Oh my god Shady. I mean, what can I say to that? What can I say to that got anything to reply Shady? There's a source fabric, right? Nice one there on the jacket relic box to No, thank you. That's a that's a showstopper right there. That'll work One million Let's go my man Tusken Raider on the base and blue is gonna be Count Dooku Dooku blue Jacob not not much of Shady there There's a mall and grief cargo on the base and this one is gonna be a gore Koresh on the auto number to 50 That is John Leguizamo the actor. I remember John Leguizamo Actor on a gore Koresh Alright, I'm thinking the right guy, right? Yeah, that guy John Leguizamo. Yeah, he's actually in a lot of stuff. Oh, yeah. He's the voice there. Yeah Oh, yeah, it's not a bad one there up all It's actually in a lot of good movies and stuff Great. He's in a lot of good movies 265 K not bad there appreciate you both I appreciate you both There's a layup and there's a Han Solo that one is one of one There we go, Paul Han Solo on the 101 base My man Paul there we go. We'll get that in a bag for you, sir Han Solo on the 101. I did not even see one of these the gold That is clean right there. There we go. Mr. Paul My man Paul got the Tatooine sand ape got Cad Bane number to 299 And that is gonna be a green the armorer on the source fabric relic. He's a leather there No one is 1099 piece of the belt 1099 Alrighty, that'll work. I don't work one more for you, Paul One more for you, sir.  There's a so uncivilized on the quote there And blue is gonna be John John There's a layup nice one there on the trash compactor to 299 from a new hope Lay at a 299 and on the back we have auto to 25. It's gonna be cursed sancin That's forest for night skin two out of 25 carry Jones as cursed sancin Nice one there from a book of Boba Fett Well, all righty there, mr. Paul that should do it for your box there my man Nice autos there like a Zamo and the one-of-one Han Solo good box for you there my friend appreciate you appreciate you


Can you hear me okay? Good? Rock on. I think we'll go ahead and get started. So yes, the hitchhiker's guide to Ruby GC. I, like Justin, speak very quickly. So if I do speak, I get going, I get excited because Ruby's exciting and garbage questions is cutting.  Yeah, yeah, exactly, please. That would be awesome. So unlike Justin, however, I don't have any TenX insights for you.  My talk is, in fact, literally garbage, or about garbage. Speaking of, did you guys hear about this, this controversy about the show Dirty Jobs? Maybe it was just me. Basically, I guess that has something to do with the huge number of micro services that they're employing. You can, yeah, thank you. Somebody laughed at it. All right, good, good, good. Yeah, I also don't like enjoy my puns nearly, like as much as Aaron does. So I'm gonna just put a line through that. I'm not gonna do that anymore. Anyway, all right, cool. So yes, I should say I'm learning a lot. That was a terrible joke. I'm learning a lot at this conference. I'm learning a lot at RubyConf. And I'm trying to apply it immediately. So Gary had a great talk about ideology and belief, and it's one of those things that I'm sort of trying to internalize. But it's hard, right? Like we don't know what we don't know. And even when we know it, sometimes we are unable to disarm ourselves. So this is my first time giving this talk. This is actually my second talk ever. I spoke earlier this year at RailsConf. So I'm going to try to confront my own imposterdom and also channel Aaron and not die. So, and also you'll see that my nervousness manifests in obnoxious slide transitions. So there's that. Anyway, so my name's Eric Weinstein. I work at a company called Conde Nast. I don't know if you guys have heard of Conde. You're probably familiar with the various brands. So there's Wired, The New Yorker, Vogue, GQ, et cetera. I really like writing Ruby. I write JavaScript a lot at work. So it's nice to be able to write Ruby for some of those projects and on my own time as well. The Conde Nast Entertainment folks actually are all using Ruby in Rails. So we are hiring. I feel obligated to say that we're hiring. You might be interested by this strange hash and why is it a hash and not an object, like a person.new. And that is foreshadowing. So you will see. There's a lot of literary devices in this talk. So also obligatory self-promotion. I wrote the Ruby curriculum on Codecademy a couple of years ago and I also wrote this book called Ruby Wizardry. It's for kids ages eight to 12. There's a really great Birds of a Feather organized by Jay McAvron, who actually is doing a talk on method lookup later in this very room. So I highly encourage you to go to that talk as well. And if you're interested in learning Ruby, teaching Ruby, kids, Ruby, nouns, please come see me after the show. So No Starch has been delightful. It is offering a 40% off. So if anyone does want the book, RubyConf 2015 and it'll be 40% off, I think for the week. Garbage collection. So there's a lot of mythology around GC and GC tuning and sort of how it all works. It's actually not as bad as it seems. And for those not familiar, the don't panic is kind of like emblazoned in large friendly letters on the cover of the Hitchhiker's Guide to the Galaxy. This is also as much for my benefit as yours. So part zero, because this is a computer type conference and we should start at zero. Ruby is not slow. Okay, yes, sort of sometimes depending, it can be. But not for the reasons that you think. So people will say, okay, well, my Ruby program is slow. It must be a database thing or it must be, there's some super linear, crazy, like four deep nested loop and I'm doing something bananas in there that I shouldn't be doing. Or Ruby's an interpreted language and can't possibly be fast and we should all be using Go or Java or something. And so really what I found is that when Ruby programs slow down, these aren't always, or even often the culprits, the object space in NGC is actually extremely rich part of the language and not surprisingly, when you have a lot of richness, there's a lot of nuance and performance bugs can hide in there. These things are true better on the screen. They sort of do make some operations slower than Java or a confiled language. But the reason that we have all this for better and worse is because everything is an object. Not everything blocks or not objects, but you get the idea. So let's take some time and talk about the history of garbage collection in Ruby. First we're talking about MRI, C Ruby. We're not talking about Rubinius or JRuby, which have different garbage collectors. I'd wanted to include them in this talk, but unfortunately I only have so much time and they ended up on the cutting room floor. I also don't know nearly as much about them, but if you are interested in Rubinius or JRuby or have some cool stuff to share, please come find me. I may make comparisons to these, alternate implementations if the comparisons make sense. So they might kind of make guest appearances, but by and large the talk is about MRI. So let's talk about Ruby 187. 187 uses tracing as opposed to say reference counting GC, and GC traces are sort of like, you're looking for reachable objects in the object graph. So if by traversing objects I can get to one, that object is reachable and great, that should not be collected. There are still references to it. As demonstrated in the graph. And if they're not reachable, if an object is not reachable, it is eligible for collection. 187 used very simple mark and sweep. Mark and sweep was invented by John McCarthy, that's right. It's not Alexander Graham Link. For Lisp in 1958 or 59.  And garbage collection works this way in mark and sweep. Ruby will allocate some amount of memory, we'll talk about details in a little bit. When there's no more free memory, Ruby says, okay, great, I'm gonna go through. I'm going to look for all of the active objects that I can find. I'm gonna mark them as active. And then anything that's inactive, I can sweep onto a new list, and that's where I'll go when I need more stuff. So this is what Ruby is doing. This was a fun animation, I like the arrows moving. Anyway, so the important thing to realize though, when you're marking and sweeping and marking and sweeping and having a great time, is that everything stops. Because reachability in the object graph can change from when you are marking and then sweeping. It can change while the program is executing, and it does change while the program is executing. So in order to mark and sweep, the collector has to stop the world.  Everything stops, Ruby marks, sweeps, everything's great, and then continues execution. So in 193 we got some improvements. We got lazy mark and sweep. And this is an improvement because it increases, or rather it reduces the pause time, by saying, okay, I'm actually just going to sweep in phases.  And if you do have like a highly eventful or IO driven application, you have a web server, you have something with a GUI, and you can't just like sit there for a couple seconds while you're collecting garbage, this is a big win. Unfortunately, 187 and 193, both subvert native copy on right, which we will also talk about. It will be on the quiz. That's a huge lie, there's no quiz. Just more information. Anyway, so this doesn't reduce the kind of overall pain of stopping the world, but this is sort of amortized that over more sweeps. So in 2.0, we got bitmap marking. So we are no longer marking objects directly, rather we have a bitmap that represents the state of objects and their eligibility for collection. This will be extremely important later because this is what sort of allows us to use copy on right and have a great time. I'll be covering all these in depth pretty soon. I just kind of wanna show you where we're going on the journey. That is this talk. So yes, so if like Aaron, I don't die during this presentation, I'm gonna be turning 30 in March, which is kind of like when I become old, I guess. I don't know, I guess each decade is a collection. I'm talking broadly about Ruby 2.1. So we have generational garbage collection, two generations, a young one and an old one. And if you survive three collections in 2.1, you become old.  You have a lot of objects that appear and do something and then are gone. And so based on the fact that objects tend to die young, it makes sense to do kind of fast minor GC frequently and the slower stop the world collections less frequently. And if you're interested in the Argin GC algorithm, Kaiichi has a talk, I think from Yuriko a few years ago, which is excellent and there's a link at the end of this presentation. So that was sort of the history of Ruby 187, 19, and then two. I think it's 2.1 and now we're gonna talk a little bit more in depth about 2.2. Two, but it's 2.2 in general. And we'll talk a little bit more about copy on write, bitmap marking, all the stuff I mentioned. But here I'm just gonna focus quickly on two things, incremental and symbol GC, which we have in 2.2. And we'll also talk a little bit about garbage collection tuning, which is scary and amazing. So symbol GC, you may have, if you've read, Shneem says an excellent write up on symbol GC. And if you've read that or if you've been writing large Rails or Ruby applications, you're familiar with this notion of like symbol denial of service, right? You have a bunch of symbols, they never get collected because they don't, they're alive forever. And if you were to do something strange but not on the face of it silly, which is to, I don't know, let users generate something that will create a symbol, and someone creates thousands and thousands and thousands of symbols, you will eventually run out of memory. That is bad. It turns out. And so what we have now is the ability to reclaim some symbols, not all of them, and allow those to be collected when there are no more references, when they're no longer needed. And the reason that I say some and not all is because Ruby internally will generate symbols for say, method names, and you could easily toss yourself again if you did something like, I guess, dynamically generate a lot of methods that'll get their own symbol. That's unusual. Anyway, so we have that, which is nice. But the really cool thing is we have incremental major GC. Again, there's another algorithm that there's excellent blog posts and papers on it that encourage you to look up. The cool thing here is the sort of tri-color marking. And many of you are probably familiar with this. But the idea is that we have three types of objects. We have white, which are unmarked, gray, which are marked, and may refer to some white objects, and then black, which are both marked, but are marked but do not refer to any white objects. And here's how the algorithm broadly works.  Everything that's alive, obviously alive, like things on the stack, those are gray. And now I'm going to start picking up, I'm gonna pick one gray object, and I'm gonna keep doing this for all of them. I'm gonna visit every single reference and color that gray. And then when I'm done with this, I'm gonna go back to that first gray object and say, okay, this is now black since it does not refer to any white objects. I'm gonna keep doing this and keep doing this until I only have black and white objects. And this tells me, okay, great, I have black objects, which are obviously alive and white, which are obviously available for collection. So I'm gonna go through and sweep, and that's sort of how the algorithm works. This third part, the part where we go through and we do all the color changing and we change the original node back to black, this is sort of what's going on in the incremental part of the algorithm. Like Ruby will do some execution, and then it will do some sweeping, and then some execution, and so on. But there is a bug, and I learned this from Aaron. Emoji, so yes, I'm learning a lot at this conference. I was gonna make it like dance around, but yeah, that was a bad idea. So anyway, so what's the bug? The problem is what if you have a white object appear, so we create a new object, and there's no gray objects with references to it because they're only black and white objects, we are going to inadvertently reclaim this live object by mistake. It will be white when the algorithm runs, the next time it finishes executing some Ruby code and says, oh, this is a white object, it is available for me to collect, and our live object that we wanted is gone. This is a bad thing. So what do we do? He said, so there's this cool thing called write barriers, they are super effective. You know it because it says so on the screen. Basically, for a lot of complicated reasons, there are insufficient write barriers in C Ruby, and that is the thing that you should ask Kaci about, or somebody who knows much more about write barriers than I do, I am not unfortunately a write barrier scientist. But basically, to sort of circumvent this, we now have write barrier protected and write barrier unprotected objects, and what we, the plan here is okay, I'm gonna, because the pause time is relative to the number of living write barrier unprotected objects, and most objects are like user defined ones, strings, arrays, hashes, things like that, are write barrier protected, the pause time is not gonna be that bad. So what is the actual fix? If we're like, okay, this is not gonna be that tricky, we can apply this to kind of fix the problem. Essentially, after all the black and white objects are identified, right? But before we collect the white ones, we wanna go and say, okay, I'm gonna scan from all of the unprotected black objects, we can actually guarantee that the ones that are protected are managed, and just kind of do another check. Like, has anything basically changed? Have new white objects appeared since I last checked? And by doing this, we kind of say, okay, great, now I'm not gonna have this bug where I inadvertently collect objects that I shouldn't. We're not gonna have a problem with losing things that I really didn't want to allow to be collected. So that is sort of a brief history of GC in Ruby from 187 to 22. We can now talk about GC tuning, and if there's sort of, if there's one TLDR, if there's one thing you take away from this talk, it should be this slide. Do not do it. Or rather, for experts only, don't do it yet. And this is a paraphrasing of Michael Jackson, not the Michael Jackson, Michael A. Jackson, but I guess it's also A. Michael Jackson. But basically he said yes. In terms of program optimization, any kind of optimization, don't do it. And if you really know what you're doing, okay, fine, but don't do it yet. So what happens if we decided we're just going to try this?  These first two, heap growth factor and heap growth max slots, lowering either of these will trigger more frequent young object garbage collection. You're essentially saying, hey, like when I get new heaps, which we'll talk about in a second, you can, I think the default in one nine or two, it may still be 1.8, but at one time it was 1.8. So you have 10,000, then another 10,000, and then okay, it's gonna be 1.8, I'm gonna get 18,000. And this will say, as you need more memory, great, here's larger and larger chunks of memory to use. So you can lower this, and then you run out of memory faster and you are forced to collect the same thing with the growth max slots. The latter three, the malloc limit, the malloc limit max and the limit growth factor, lowering any of these three will tell Ruby that it's not allowed to allocate as much off-heat memory before running minor GC, which also triggers more frequent object allocations or collections rather. And you can sort of do this with old malloc, which is, I think the name stays for larger, like major GC, but this is probably a bad idea because as we've seen, if you start triggering a lot of major garbage collection, you're going to be sitting there collecting garbage instead of sending emails to your users or something of that nature. The important thing to realize is this is not a silver bullet. There are no silver bullets. There are a lot of werewolves. There are no silver bullets. It's a bad time. So there's, you know, this is also not as helpful as it may seem. There will be times where you say, yes, there's a lot of objects, there's a lot of stuff that's going, we're churning and garbage collection is a problem. We've identified this as kind of a thing that we should do. You can inadvertently make things worse for yourself by modifying these variables and not doing a lot of measuring and being very careful, right? This is also one of those myths. It's very attractive. It's the source of those like weird old tricks and tips about XYZ. There's a lot of mythology around things like bit twiddling and garbage collection.  This is something you just wanna measure a lot beforehand, after, make sure that what you're measuring is actually what you're measuring because oftentimes that is not the case. Just kind of proceed with caution. So that said, we're gonna move on to, I think the sort of the bulk, which is this case study part three. So a couple of years ago, I was working at a company and we had a Ruby application. It was interesting in so far. It was not a Rails application. It was a suite of seven Sinatra applications that had been sort of smashed together in interesting ways. And the way that this worked is, users would browse to the site, they would go to the web layer and the Ruby application would make requests to a number of Java services. The Java services all spoke JSON. So the Java service would say, hey, I have some JSON for you and Ruby would say, awesome, that's great. I love JSON. And would kind of inflate them into hashes and then pass them around. So you would just have these huge hashes floating around and people would just start picking stuff out of them or mutating them because that's the thing you can do. And it was a bad time. And so someone got this really crazy idea and said, why don't we take some objects and orient our code around them? And I suspect this is a fad, but we were like, all right, we'll try it because this hash thing is not working out. And now you see why earlier there was a hash and not a person that got nude up because hashes are a thing. So anyway, we were talking about doing this and we started doing it and performance tanked. We were constantly running out of memory. We were sluggish. We were having all sorts of issues in New Relic. Everyone was having a hard time. The business was yelling at us. We were yelling at each other and we couldn't figure out why when we decided to write object-oriented Ruby, we shot ourselves in the foot. So let's talk about memory. And again, this is all in the context of 193. At the time we were running Ruby 193 and we were sort of trying to figure out what's going on and this is sort of how the switch to two happened. So the memory model looks something like this. Ruby objects are 40-byte R value structures which Ruby allocates into heaps of 16 kilobytes each. This is for a 64-bit architecture. I suppose for 32-bit it's gonna be somewhere like 20 or 24, but we'll say for argument's sake that we're all using 64-bit machines. So you're gonna get somewhere on the order of 400 Ruby objects per heap because you have 16,000 bytes divided among, you have 40 bytes per R value structure. And Ruby will give you about 150 heaps to start, which is awesome. And so you can kind of test this yourself here. We're inside the Sinatra app and you can see the object space. There's somewhere, there's about 408 objects per heap. So in that 400 ballpark. And it turned out we were making a huge, this is a little bit hard to read, I apologize, a huge number of objects. So at the top you see BXR console, it's just my alias for bundle exec rake. The console task starts IRB with the application loaded. We say, okay, GC start, great, and then GC stat. And the interesting things in here are we see the number of total GC runs. We see the number of heaps with at least one used slot. The heap length is the total number of heaps and heap increment is how many more heaps to ask for, which I think in this version of Ruby was 1.8 times the previous number. But the most interesting thing is this, the heap live number, they were half a million objects just to start. We weren't even doing anything. We just started the web server and said, hey, how many objects are there? It's half a million. I would say that for comparison, there's an average Rails app would be somewhere closer to 400,000, but it's sort of a nonsense statistic, right? Like there's no average Rails app. We all have very different business names. We have different versions of Rails. We're running different versions of Ruby or different Ruby implementations. Different web servers like Puma or Unicorn or Thin. But this seemed completely wrong for this Sinatra app or this like smashed together Frankenstein's Monster Sinatra app. And we weren't even using ActiveRecord. We were just talking to the services and getting responses. So let's talk a little bit about these R values. For small values, we restore them directly on the object. And you might have heard via Pat Shaughnessy, who has an excellent book, Ruby under Her Microscope, that there's, and this is very interesting. Again, it's one of those weird old tips, right? It's like, you don't want strings that are over 23 characters. This is crazy. It doesn't matter. If you actually really do care about that level of performance and optimization, please come find me after the talk because I have a tremendous amount to learn from you. That would be awesome. But essentially, what happens is, you have 23 characters, you have the value directly 24 and larger. You have a pointer to somewhere, other location, memory, and this is somewhat slower. So for large values, whether it's a string, or an array, or a hash, whatever, the value is actually a pointer. So the R value itself has a flags field, which contains FL mark, which we'll talk about. Object contents, which is the value, or it's either an actual object or it's a pointer to one, or you have next, which is a pointer to the next R struct. And there's R string for strings, there's R hash for hashes, R object for custom objects in user space, and these are all the same size. So we talked about heaps. So in 193, we were seeing we had 10,000 slots, which was one heap. We got second heap, which was another 10,000 slots. And every time we needed another heap, we were multiplying by 1.8. So the third time, Ruby says, hey, I need more memory. And great, we get another 18,000. So now we have 38,000 after the initial 20,000. And then if we have to ask again, we go from 38,000 to 106,400 because we were doing this kind of doubling almost this 1.8 factor. And this could be tricky if, and this is a case for tuning, and this is one thing that we did do, because what if you say, I really, really need like 50,000 objects. And so I asked for, or 50,000 slots rather, and I asked for more, and now I have 106,400. And I'm never actually going to use these. And you realize, Ruby is not going to give this back to the operating system until the process exits. So asking for more memory than you need can be tricky and there's a case to be made for doing the kind of tuning I warned you about with that regard. So let's talk more about market sweep. So Ruby heaps comprising linked lists of R values, linked lists were in fact invented by Alexander Graham Link in 1836. I realized that if you didn't see Aaron's talk, this just sounds like crazy stuff, so I'm sorry about that. So when there are no more free R values, Ruby 1.9 will set FL mark on all active Ruby objects. This is the marking phase. And then relinks all the active objects, kind of sweeps them into a single linked list. And this is called the free list. Here's the free list. You can kind of imagine it in your mind. You have a linked list, marked objects, some are not marked and the ones that are not marked are available to be reclaimed. So they get swept and used again. I just love that animation anyway. So copy on write. We talked about this a little bit ago. Copy on write, the idea is when your production process or any process calls fork, the new child process shares all memory with the parent and then copies are only made when a write is forced, which is cool, this is great. You don't actually have to write anything unless there's something different. And so the fork process and the parent, as long as you're not mutating stuff, they can share memory and it's, you have this sort of persistent data structure and it's really cool. The problem is if you mark an object directly and say you are marked, you are available and then there's a child process somewhere that object is not marked. So you have marked and not marked. You have these objects that sort of proliferate that only differ in their eligibility for collection and this is bad. You kind of get a proliferation of objects, this kind of subversion of native copy on write and it's not necessarily true in all places on Linux boxes in production and on your Linux machine or your OSX machine. They do leverage copy on write. We'll assume that it's true everywhere. There are some instances where it's not. But basically now we have all these objects floating around and for a web server like Unicorn that does concurrency via forking, the more Unicorns you have, the worse your problem gets because you're constantly writing new objects. So this is the erudite portion of the presentation. You can tell your friends and colleagues and coworkers that you learned something from my talk, which is a quote from Shakespeare. So this is from the Tempest, the idea being, okay, we don't need to do all these writes. We don't need to have all this, so let's not. And so this leads us to memory and bitmap marking as mentioned before, maybe Ruby 2.0. So every heap now has a header that points to a bitmap and you can kind of, it's a little hard to see, but these ones and zeros correspond to marked or not marked in the actual heap slots. So you no longer have to mark an object itself as marked. You can just update the bitmap and that bitmap keeps track of who is available for collection and who is not. So this header is, one is marked and zero is unmarked. And so Ruby 2.0 with this header, just kind of simplifies this and allows us to actually leverage copy on write that you see marked no longer modifies objects and we only have one object. If it doesn't change in terms of its eligibility for collection, we don't have to write it among a bunch of different processes. We just have the one. And as mentioned, because Unicorn manages everything by forking, the more Unicorns you have, the worse the problem gets. Now this is not a bad thing. Unicorn is a popular Ruby web server. Forking is not intrinsically bad. Unicorn is not intrinsically bad. Ruby is certainly not intrinsically bad. Ruby 193's garbage collection algorithm was inadvertently doing a bad thing, which has been fixed, which is great. So as mentioned, as N increases, the problem gets worse. So here's some numbers. Hopefully they're somewhat illuminating. Loading the application in 193 invoked 122 GC runs and took about 4.4 seconds. And then changing nothing else, simply loading the app in two, invoked 66 GC runs and took about three seconds. So in this case, one and three, and we were looking at the GC stats and kind of instrumenting and carefully checking and there was some variation in terms of gem versions and stuff like that. We tried to get all that jiggle out and it was about 47% more time simply collecting garbage in this application. So given this information, what did we do? I was much faster than I expected. So number one is we upgraded to Ruby 2. So we could leverage copy on write. Turns out requires also faster. It's hard to see the line there. This was new at the time. It's not so new now, but there were cool features like module prepend, lazy enumerators, refinements, and there's a talk about refinements, which is awesome. Unfortunately, you are missing it, but there will be a recording, so that's good. And it was just about time. Like Ruby 1.9.3 reached end of life in February and we were talking about this, I think the previous December. So we had really a couple of months to really get wrapped up. And yeah, so that was the first thing that we did, was just make sure we were on Ruby 2. So another takeaway is update Ruby. So this Christmas you're getting Ruby 2.3 and it will be awesome. Number two is we profiled. So as I mentioned, we tried to find and eliminate sources of load. We spent a lot of time doing native GC profiling. This is Ruby 2 docs. There's also docs for 2.1 and 2.2. I encourage you to take a look at GC and sort of the methods that are available there. There's a lot of information about what Ruby is doing, much like how Aaron kind of showed in his talk, like how you can kind of pull apart and see all the instructions that Yarg is executing. You can also go through and see what objects are being allocated, how long they're alive, how many slots you have, things of that nature and it's really very cool. We also used the Ruby prof gem, which helped us and I can say, I don't have enough good things to say about it, it was awesome. And the third thing, yes, I know I said don't do it, but we were reasonably sure we knew what we were doing and it turned out, well, so far, so good. Basically, we tuned the GC. So the three variables that we touched there was the malloc limit, which controls when you perform a full GC run. The default was eight megabytes, which I think was set in something that was chosen in 1995, which made a ton of sense for 1995, but didn't make sense for us. So we tuned number one to get more memory and sort of punt on full stop the world GC because we could, you do more stuff before we had to actually do that. Number two, the heap min slots that controls the slots per heap, which defaults to 10,000, we tuned it a little bit to get more objects per heap. I wanna say we only modified it to about maybe it was 12,000, something of that nature. And then Ruby three, sorry, number three, Ruby heap slots, growth factor, as mentioned, the growth factor was 1.8, so we would ask for more and more and more. We kind of looked at the graph and realized that we were kind of plateauing a little bit and we didn't really need to do 1.8. I think we selected 1.1, 1.2. So again, lowering that in Ruby two will give you more frequent kind of GC runs for the young generation, for the minor GC, you don't have the full stop the world stuff. So some credits and some further reading. I'm deeply, deeply indebted to all these people, to Pat Shaughnessy, who has said his excellent book, Ruby Under a Microscope was very helpful in kind of pulling Ruby apart and seeing what was happening. Sam Saffron has written a great post, we demystified the Ruby GC, it's a couple of years old, but still a great read. Pat's book, Alexander Diamond has a book called Ruby Performance Optimization, which goes much more in depth into the stuff I kind of talked about at the beginning, where a lot of the issues that we see in our Ruby applications have to do with the richness of the object space and garbage collection and sort of what is around and is less related necessarily to, you know, bad algorithms or bad database queries, although those things do exist. And then again, Koichi's talk is just astounding, I encourage you to look that up as well. Blog posts on the Heroku Engineering blog, videos on YouTube, they're all excellent. So really, thanks so much for your time. I really appreciate your taking time from your RubyConf to come listen to me talk about stuff. And again, I guess obligatory shameless self promotion. This is me, this is who I work for. That's the book that I wrote. And yeah, thanks so much. I'm sorry, I don't understand the question. Oh, out of band GC, that's a great question. So that was something that we were trying to figure out for this application. So the question is out of band GC, what do I think about it? The idea is you essentially tell the garbage collector, you're not in charge of when you run. I will tell you when you're allowed to run. This is the thing that is useful if you have something like a web application where there are requests coming in and someone could be in the middle of a very complicated request and Ruby will say, hey, time out, I'm out of memory, I need to collect, I'll be right back and then just do a major garbage collection right in the middle. You don't want that to happen. So the idea is you say I'm going to only allow garbage collection in between requests. Like maybe every 10 requests, every 100 requests, every 300 requests, that's when I'm gonna do some garbage collection and then back to the show. For Unicorn, at the time the tools available were Unicorn Worker Killer and I think there was another out of band GC library that we were using that sort of allowed us to maintain memory while it's kind of sniping like big bloated old Unicorns because that would happen since we're telling GC not to run anymore. Like I will tell you when you're allowed to stop and it was a lot of overhead doing that memory management. Like you essentially give up all of the nice cool like automatic memory management that Ruby gives you and it's a lot to fit in your head. So while I think there are certainly times where it makes a ton of sense and it can be very, very useful, we found it was too hard for us to get right which does not mean it's not too hard for you and your team to get right. How long should a major garbage collection take? That is an excellent question. I feel like I don't know the answer.   With the newer stuff in 2.2 and the ability to kind of incrementally do it, I feel like there's, the applications I've worked on, it was like less than a second, like more than a second. We're kind of like, oh, this is taking a long time. Like what's actually going on. But I think it's gonna have to depend on your application and your needs, yeah. Where do you, oh, the book, yes, like I said, the flashing buy now button. So you can get the book from your local bookseller. It's published by No Start to Press. It's available on Amazon. It's available at Barnes & Noble. I wish I had copies with me, but they're extremely heavy. Like it's something like 340 pages. Like it's surprisingly big. They're illustrations, so yeah, it's pretty cool. I'd be happy to show anybody like a PDF for some sample pages on my machine later today. Like I said, I wish I had a copy, but I'm not good at marketing, it turns out. Correct, yeah, so this is, yes, to be clear, that's exactly right. That's a good question. So the question is, this code is for No Start, and that's correct. So this is not something that you can use with any bookseller.  And if you put in RubyConf 2015, it will be 40% off. Like I said, it's for kids ages eight to 12. Certainly as young as six or seven. If they're really motivated and their parents are willing to help, because it can be kind of tricky. And I suppose up to high school, but it's sort of like the phantom toll booth. Like there's a time to read it, and that time is not maybe when you're 16. But I've had adults tell me that if they liked it, so if you wanna learn Ruby, maybe it's helpful for you too. Rock on. Well again, thanks so much.


Hey, good afternoon, everybody. How are you? Okay, the first one is always a little, you know, light. The next one you guys are all ready. Okay, so how are you doing? If I kept going, like, eventually, would we get amazingly loud? I don't know. Yeah. Okay. We'll try it at the end if there's time, okay? So you have something to look forward to. All right, so this is powering Aline's startup with Drupal. This is the name of this talk. My name is Chris Shattuck.  I just wanted to let you guys know. I practice my talk. I practice my talks on my four-year-old son, which is kind of brutal, right? But it's really interesting as well because we end up having this conversation.  And I get a sense of how us as adults might react to certain, you know, aspects of a presentation. Right? Part of us is still four years old. So even though we're not going to start talking about Mario Brothers midway through a talk, we might feel like we want to. And so, and I think it's a good practice. So I threw in some spaceships and some kittens into this talk, hopefully, you know, to entice him. But also, you know, maybe you guys will get some benefit from it, too. Okay, so this is the URL up there. If you want to listen, I have recorded it. That's even worse, right? I recorded it in a talk with my kid. And so you can hear the crazy things that a four-year-old says. All right, so the reason I'm giving this talk is because I run a startup called Build a Module. I create video tutorials to help people learn Drupal. And I've been working out a full-time for a couple of years now. And when I come to Drupal events like this one, or Drupal Camps, I end up talking with people quite a bit about the business side of this because most of us are entrepreneurs on some level or trying to figure out what to do next. And so, you know, we draw from each other in terms of how to deal with the logistics around that or how to, you know, what are the tips and tricks on making the steps up to running a successful startup. So this talk is really a response to that. It's some of the best advice or tips I can give as you work your way toward a startup yourself. How many of you guys are interested in running a startup in your self? Awesome, and how many of you are right now? You're doing it. Okay. Okay, doing it. It's two different things, right? Okay, so that's really great. That's really great to hear. I hope there's something of value to you here or maybe you'll recognize some of this in yourself. Part of this has to do with lean. So the lean startup, EVOS, and part of it has to do with Drupal. It has to do with the process. But then there's other things to have to do with maybe the soft or sad of ourselves. That sounds weird. We'll get to some good stuff. I'd like to begin by saying thank you. So anybody out there, a member of Build A Module or has been a member at some point? Okay. Thank you so much. Build A Module has become sustainable in such a way that I'm able to create a pretty flexible workflow. And a couple months ago, my dad got pretty sick. This is a little personal, right? But my dad got sick. But I was able to basically drop everything I was doing and help him get back on his week. And that was a really valuable experience where we had probably the best payoff that running a startup has had for me so far. Really, like, is there any better payoff than being able to help the people around us when they need it, right? So this is part of looking forward, looking ahead and seeing what's going on and looking forward, looking ahead and seeing why we want to start up. This might be one thing. But for me personally, I just need to say thank you to everybody who had a part in that. Which you did. I just supported me. So thanks. Okay, so I'd like to give you just a couple minute background on how I got to this point. Hopefully it provides some relevance that will at least be one story of how an individual makes career moves or whatever. But I'll try to keep it brief. So I graduated from college with a degree in sociology which basically means nothing. Right? Any sociologists in the room? Yeah, yeah, right. We find other things to do to actually make money. So I worked at a campground. Yeah, right? It's natural transition. So I started working at a campground and interviewing people as I came in to see a campsite to ask them what they did for a living. And to get a sense of maybe what I might actually really want to do with my life. And one development sounded pretty cool. I had a computer, which was all you need in order to do it basically. And I always wanted to be kind of in. So I thought I'd go this route. So I spent a couple of slow winters working on learning coding, learning design, and how to give me market, how to deal with clients. I was asking around to see if anybody needed a site. This one gallery said they did. I did for the job. I got it. Did the work. They were happy with it even though I was totally new on it. And when I tallied up the numbers I was making four times more per hour than I was at the campground. So I quit. It makes sense, right? And I'd like to say I went into freelancing full-time, but what I actually did was I went into trying to network full-time or miserable. So I went to networking meetings. I just signed up for Toastmasters and got up at 5.30 in the morning to try to talk with people.  After six months though I had enough business that I was able to pay the bills and so my wife and I were able to buy a little home and pay the rent instead of like that. During this time I looked at my in-laws to kind of cut down on expenses but it was nice to move out too. So I freelanced for quite a while before I started building a content management system to make it easier to create these websites over and over again for different clients which is a very common progression. And then at some point I wanted to help with it and after finally going on Google and looking like, oh yeah, I discovered Google about this line too I found out that a lot of people had done this already including this one project, Drupal and after looking at the architecture and talking with some people I decided to go to Drupal completely so I read ProDrupal Development which was a really valuable book at the time that was in Drupal 5 and I just started doing all my projects in Drupal which was kind of just went in cold turkey which was probably the best way to learn. So out of six months into working with Drupal I got offered a job to work on a large scale Drupal project and had a budget of over a million dollars pretty big deal at the time and it would still be a big deal for me now but I'd get to work with a team of Drupal people which is kind of a really exciting thing if you've been freelancing for a while so I decided to do it so I worked on this job for about a year and I learned a lot of really important stuff but it kind of reached a cap of both the challenges and the income level I could reach as a Drupal developer which is substantial, right? So as a Drupal developer there's good news for you but there's still a cap on what you can make and so I wanted to figure out what was next, I kind of wanted some new challenges and I had read this book called The 4-Hour Workweek at this time how many of you have read that book? Okay, quite a few of you if you haven't picked it up there's something in it for you that's kind of fun but one of the big takeaways for me was this idea that we're going to break through the cap that we may make once and it can sell many, many times over and that's the only way that's the only way you're going to do it so coming out of this job I split my time between two things I started sub-contracting for freelance shops so that basically I didn't have as much to think about and I could rely on the number of hours that I'd be working and then the rest of the time I started prototyping the first build module site and I put it out there with a shopping cart and let a few people in the triple community know it existed and I really didn't I didn't know what time it spent but I got some orders that came through the site and I was excited and just kind of waiting for their email back asking for their money because it wasn't perfect but nobody asked for their money back which was a great illustration to me of one of the lean startup principles which is that you put something out there before it's perfect because the market will tell you what it wants to make it better so I just kind of got to use that I didn't purposely do it it was just a time thing but it worked so after looking at the numbers I wasn't making a ton of money that way but I thought maybe if I could make enough content for enough sub-sections of the triple community and work on some of the problems that we face with video learning like it's kind of hard on some levels maybe I could make a living doing this so I stopped working all together and I spent three months building another version of the build module site I recorded a couple hundred video tutorials tackling some other subjects and I put it out there and I gave myself six months I said if in six months I'm able to pay the bills I'll keep going, I'll keep working on it otherwise I'll go back to the drawing board and figure out what went wrong try something else but I hit that point I didn't have very high expenses which helped but I hit that point and I've been working on it ever since so this hopefully that wasn't too long but for one the shape might look familiar and I just wanted to sort of explain why and also throw in a spaceship because the four year olds need spaceships sometimes but this sort of shape is what I'm doing as a job but then the transitions and the transitions is pretty much what I want to talk about for the rest of this time because those are the hard parts making those moves between things so there's a lot about my story that's idiosyncratic it's just me, everybody's stories is going to be different so we'll all tell it differently but one thing that's the same are these transitions we have to make transitions from one step in order to continue improving our lot in seeking whatever it is that we're seeking so there's three things that I think go into making a transition actually work and they're the same for all of us regardless of how old you are regardless of if you have families regardless of if you're just out of college or just hitting retirement it's the same for all of us and the first is that we have to see the next step the next thing that we're going to do is less risky than the one we're going to add otherwise we're not going to make a move if you see freelancing is less risky and you're an employee then you're not going to make that move because there's nothing in you that's going to support that so you have to kind of figure out how you can see that next transition if you know you need to make it you have to figure out how to see it as less risky than the thing that you're currently doing so that's the first part the second part is that you need money because transitions take time you have to learn some stuff you have to build some social networks there might be a variety of things you have to do and that takes time you're going to burn through expenses during that process but really it's just time you're just buying time so saving up some money for those transitions is also a necessity of course you can't save a ton most of us can't save a ton for each transition so we also have to set kind of a time limit and say okay within this time period and then we just have to save up some more and try again if it doesn't work and the final thing that we need is a little bit maybe harder to put your finger on but what stops most of us from successfully making a transition is that we back out before we complete it we get scared because as you sort of make a leap from one thing to another from one job to another you're in the air there's no solid footing and in time it's really easy to just say okay I want to go back to something I know that's comfortable so we have to do what we can to increase our stamina for uncertainty we have to be okay with that process of not really knowing what's going to happen next because it's the only way that we'll be able to make those transitions and so I want to talk about some strategies for building that if you isolate that colony ship of my life into important phases that I think are generally applicable to us all there's two big transitions I think that I would suggest making we can always go from an employee ship to a startup we can always make that jump but I suggest freelancing in the middle for a variety of reasons which I'll talk about so these are the big transitions between employee ship and freelancing and between freelancing and a startup but why are we pointing to a startup though as the thing that we want to build up to or that we're building many of you are in the process of building it now which is super cool so why well if you break it down there's probably a whole list of things that you think you're going to get from it one is that you might make more money well you're going at it to make more money but that only really satisfies us up to a certain point after that point it's the amount of it's how we can change the lives of other people it's the good we can do that's a much stronger driver for us once we've reached a baseline of income that's going to be much bigger and finally we kind of might run out of challenges as employees or as freelancers and running a startup is going to give us more to work with we'll try some new things we'll have to solve some new problems but I think all of these things lead up to one big goal which is not unhappiness so I did a Google search for happy and I'm like I gotta throw that up there for you those of you in the back she looks super unhappy I don't know what's going on there but this cat looks much happier in contrast I promise kids so even though we have these goals to change our circumstances in terms of money we make happiness we want to be to enjoy life if we didn't have to do these things in order to enjoy our life more we would skip it and go right to the part where we're enjoying life more so in addition to happiness being our goal and I'm using happy loosely not always like that word because it comes with baggage but if you can think of it as well being or enjoyment of life whatever sort of works for you in addition to being the goal of a currency it's also fuel we use to make transitions that are challenging because if we can enjoy ourselves in the process of jumping from one point to another we have a lot longer to make that transition before we exhaust ourselves right so it's like fostering happiness cultivating happiness in whatever way we can is a big deal for making sure that we don't bail too early before we actually make a transition so on the one hand it sounds like you know I like a little fruitful because like yeah of course everything on TV tells us what we can do to be happier everything around us is telling us that we can be happier if we do X so I think it's important to break down the pieces that we know about happiness because that helps us make choices about what can cultivate our happiness and there are some things we know from studies that have been done so one of them is really interesting which is that about 50% of our happiness level this is based on a study that they did of identical internal trends about 50% of our happiness level is genetic so that might be bad news for some of you for those of you I realize this for those of you for whom it is bad news you might not have a lot of happiness in this 50% genetic area so I'm sorry it's kind of a feedback loop but there's 50% left so this is the good news of that 50% 40% is intentional activity it's stuff that we decide to do at any given time so there's at least a handful of you out there right now for the reason I'm not talking about what you were hoping to talk about maybe the guy next to you is snoring something like that well those things can be changed but it's simply executing your control for your environment you can go do something else or pull out your computer there's options for you almost at any time when there are conditions that are making you unhappy there's something you can do to make it happier so 40% of our of our joy comes from those intentional actions which is reason that's a lot of choice that we have so this little orange slice which you may or may not be able to read is our circumstances but only 10% of our happiness level comes from our circumstances so this is how much I think we are this is how much money we have this is where in the world we live this is what job we have all of these things add up to about 10% which is really weird because I think most of us when we think about or describe how we're trying to improve our lives kind of point to something in this sort of on this list and say that's what I'm going for you know but it's really not going to have happiness which I think is amazing to me and you may not believe it but think about it for a while maybe it will start to sink in so another thing that makes us happy are puppies and babies especially puppies pushing babies up I'm just kidding that does make me happy but this picture illustrates a broader principle which is that of the things that we can do intentionally to make us happier one of the big things it actually releases the same chemicals in our body when we do something for somebody else it's when we drink juice or do drugs like this is the same positive chemicals are released so why is it so much fun to help people it's because it's actually doing something physiologically to us so if we can integrate that with what we do in our work lives especially where sometimes we don't always have the opportunities to do those things then we're going to get a lot more joy at the process so this comes into play when I start talking about a group over the bin so money makes a difference in terms money makes a difference in our happiness level but only to a certain point at about $50,000 we reach the peak of how much money can affect our happiness $50,000 a year as income bring about the electricity being turned off for kids or fed $20,000 and $5 million the happiest level of people increases it is a bit of an amount it's a little bit but it's not huge in any way so I think that's important because if we're making moves in our careers and where chances are there's not going to be a big payoff there for us if that's our only reason or our primary reason for it for a lot of us we want to make more money so that we can save more money so that we increase our security level so that we can get closer to retirement so that we can do some big things well that's another story so we're amazing you are amazing all of you guys are amazing I could have told you that without these slides but the slides help too and one of the things that makes us amazing is that when big changes happen to us we adjust it at really fast it's called adonic adaptation and so this comes into play in a really positive way when happenings happen to us we get diagnosed with a chronic disease after being diagnosed with a chronic disease within one or two months many of us will get right back to the same level of happiness we were before and have some impact on our level of happiness but if really big things really big good things happen to us like we win the lottery which is arguably good for those people who do get positive feelings from that they go back to the same level of happiness about a year later but if you are saving up for money for retirement for big things down the road the chances are you're going to get some payoff in terms of happiness but it's not going to be long term it's going to expire you're going to adjust so you may find that focusing on the sooner payoffs in happiness your day to day stuff you're going to end up having a greater net level of happiness and that's what you need this is a currency right we're trying to get more happy we're just doing something we're going to make more money so these are all interesting things anybody find these interesting anybody not find these interesting that's a cruel question ask so these people are happy because they were asked to jump and smile but they look happy for that reason but some people are actually happy at their jobs which if you're an employee and I'm completely jealous I've never had a job where I was really satisfied as an employee but if you have one of those your goal is achieved right and the whole idea of making multiple transitions to get to the point where you're running a startup maybe that's not very interesting because you've got everything you need but for most of us there's something lacking with employment so I wanted to stick freelancing in employment into a cage let's compare being an employee to being a freelancer see what the benefits might be in freelancing and the problems with employment so as an employee your time is dictated in a big way so a certain number of hours you have to work you have meetings you have to go to but as a freelancer you have to set your hours for the most part freelancers tend to work more actually more at hours but they get a lot more control of when those hours are so you get to craft your life in such a way so that you can take advantage of things that you'll get to like if it's a really nice day you can just take a break so we get that advantage as freelancers as an employee and by the way if there's any bosses out there I don't mean to rag on you guys you're probably all awesome bosses and you're awesome bosses and your employees are probably all really happy but just in case there's other people here who aren't this might outline some of those things disclaimer so as an employee the skills that you build are dictated by what's needed in your job and those skills may be very outdated you may be working with old technology that's only good within whereas when you're a freelancer you have to choose skills that are and you also get to choose the skills you want so these are skills that you may use later as sort of fuel for your startups or to build other things that you've always wanted to build so you get to choose what skills to build which is a big deal as an employee your job is making your bosses happy really there's kind of the primary target but as a freelancer your job is to make the market happy dealing with the people who are actually buying stuff and so you get to know where the inefficiencies are in your work so if you do a lot of stuff freelancing for don't really find it valuable well you just discovered a big way that you can save on time and if you you'll find little things in a lot of time so those kinds of things those types of insights that you develop while freelancing those are things that you can take when you start to build a startup needs in the marketplace how to sort of deal with the market okay so finally when you're an employee your income is dictated not only by the market but by politics within the company like you can only make a certain amount you should make more than somebody who's been working longer than you right those those types of things but as a freelancer what you charge is dictated by your own decision and also by what the market will pay so you can work your way up to making the highest possible amount you can for the skills that you have in whatever industry you're at which is inevitably going to be more sometimes significantly more than you can make as an employee so all that makes sense you guys you guys good it's late isn't it it's like 4.30 you guys are like dinner you know I'm great at school so feel free to just use my voice as sort of massage on your head you don't even have to hear the words so you like massage that information and get it in the order I totally that's totally fine but what's that oh the video will be online anyway why are you guys here so I tell every yeah that's so funny I should have started this out I tell everybody I meet don't go to any sessions just talk to people out there what these will be recorded so if y'all want to just bail now it's totally fine I'll finish this but just in case you feel bad about walking out now let me continue talking about freelancing because based on the previous slide freelancing is awesome right but actually freelancing is super tricky how many people here have handled freelancing or do freelancing all the time so you know what I mean I should see a bunch of nods at this so freelancing is really hard in here as well one is that if you imagine a teeter totter and there's spikes underneath each teeter totter and you're going down like this and you're like oh maybe the other side is more comfortable and you go over there and you go down and spikes are just coming up through the teeter totter that's kind of like freelancing right anybody okay so the idea here is that we're either really busy or we're not busy enough in both our uncomfortable situations we either have too much being thrown at us we have too many clients to deal with and we don't have enough of our panicking because oh my gosh I have to pay the bill so I'm uncomfortable it seems like we're never in the middle and there's a lot more factors we have a lot more clients we have to deal with we have taxes we have logistics a lot more usually than you have to deal with as an employee and finally one of the biggest things is that by definition freelancing is something that we do by ourselves and this means that what ends up happening is you end up working really hard all by yourself and one day you look up and you're like what where did everybody go and you realize you haven't seen like your friends in a month and you just get disconnected whereas when you're an employee a lot of times you're part of a community you get to see people at lunch and blah blah blah blah right and there's nothing more stressful to human beings than being separated from our communities so all this adds up to a whole lot of stress which makes freelancing not sustainable for most of us so I have some tips some ways to maybe sustain working through the process of freelancing and one of which is a way to look at it so I see freelancing as start-up school so this helps orient you in a couple of ways one because it's time limited most of us don't go to school forever right and we're sort of really scared of the real world but like most of us it's a temporary thing but also our goal is to learn as much as possible through the process it isn't to make it as easy as possible we want to learn as much as we can so that we can use that information later to do something valuable so we can learn all of the most of the same things that we can freelancing before we were at a start-up so we can learn all this stuff later when we're doing our start-up but the thing is that when you're freelancing you get paid for it whereas when you're doing a start-up and you're having to learn all this stuff you don't get paid to have a much shorter time period to work with whereas freelancing you can work and work until you're like, I know what I'm doing I have ideas, I'm ready to go okay so this is the big reason why I encourage freelancing I've been talking all day too so we're at source okay so one way that you can see freelancing as less risky than your current job is by getting some success in it like jobs or maybe even one job like I got one job and I was sold where you see that you can do it where you can make people happy you have the skills to do it so consider going part-time with your work or just moonlighting for a while which basically means don't do anything fun for a little bit and just work on something else and get a couple of successes and that might be enough to encourage you to make the leap I also encourage you not to work for huge clients just to insulate you a lot from the markets working with small clients gets you a lot closer to what's going on out there and also gives you these mirrors of insight into what you're going to look like in a little bit when you run your start so you work for small clients you get to see them make mistake after mistake you get to see them have really weird ideas and some of those weird ideas work and most of them don't and you get to derive a lot from the experience that you don't have to do yourself so this is all stuff that you can pull into your toolbox when you get to the point where you're going to run your start so small clients small clients are really irritating but they teach you a lot and some of them are really cool so another thing that makes us amazing besides hedonic adaptation is that we rarely forget about stuff that's important to us so if you thought okay I have to turn off the beans cooking on the oven in 20 minutes like your brain will generally remind you of that maybe not 20 minutes from now maybe like 2 hours from now but it will happen your brain will just keep that and run it in this carousel so as you've been sitting here my guess is that most of you haven't been keeping count but you probably thought of several things that you have to do either later after you get done with this but the deal is that if you can take all that part of your brain that's dealing with reminding you constantly about what you have to do and you get rid of it you use some other tool to remember all that stuff then it frees up your brain to focus on what you're doing right now which is much more valuable so this book Getting Things Done how many of you have read Getting Things Done so many of you have read it those of you haven't how to do that how to create a system to free up your brain to focus so for me this is an incredible thing to feel and over time entropy sets in old habits come back and I can always come back to this if I get overwhelmed and it really helps a lot the best moves I've ever made for my productivity is I started working on a treadmill desk about 5 years ago and I walk I don't run I tried that it didn't work so well so I walk and I work at the same time and it just makes all the little aches and pains that you don't build up in your body when you do desk jobs it makes them go away which is amazing a lot of people lose a lot of weight on treadmill desks there's a lot of benefits to work with your office to make it better for your body so your body is less of a distraction less of a barrier between you and getting things done so you don't play with standing desks play with different heights of desks play with sitting on balls play with the light in the room you know whatever you can think of it's kind of fun to do especially if you're sort of you know you need a break from something just mess around with your office try some different things sometimes we get to this point where we're overly stressed we're so stressed out that we just can't really do the next thing we just don't know what that is when we were depressed our bodies feel bad it's just this point where you get completely blocked and you can't get anywhere done so when we get to that point eventually something will happen that sort of unravels that but if we can act on it fast then you can kind of get by it fast so my strategy I have this algorithm in place I think it's good to have an algorithm whatever it is for you it might be different than this but I start sleeping better so I try to get 8 hours of sleep and go to bed at 10.30 which apparently lines us up with our natural circadian rhythms I start eating good meals every day I don't eat any junk food I don't eat any regular foods and finally I'll do a sanity check which for me involves pulling up a processor, a work processor program and asking myself questions and it might sound weird I don't normally talk to myself but really we have psychology tells us we have these different parts of our heads that can kind of talk to ourselves which is really valuable when it comes to working out problems so I'll ask myself questions like why do you feel so weird or stuff like what is my ultimate goal in my life just to try to unravel what it is that's working in and doing all of this together helps me get back to the point where I can actually get stuff done within a day or two like I said your deal might be what you do might be a little different but this is just one idea alright so I promise that I'll talk about Drupal because this is DrupalCon so the reason why it took so long to get to this point is because Drupal sets very well on a couple of things that I've talked about before so I wanted to make sure to talk about those first so I wanted to go through the benefits why Drupal for freelancing so for many of you this is a foregum conclusion you're already using Drupal for freelancing but maybe this will help break down the specific things that you're finding value of from but words to it that can help you derive more benefits from it so anyways first of all it's a great portable platform for the more of it so what I mean by this is that how many freelancers in here have thought what happens if I die tomorrow what's going to happen to my clients so maybe not everybody's this is more of it if I am but I've talked to several freelancers they've just independently brought this up okay if I die tomorrow you know it's not like if I decide to not work for them anymore it's always death so Drupal among any framework or CMS provides this it gives us a platform that we can use to give to clients and say hey if you need help later I'm not available for whatever reason I can find someone that knows Drupal so this is really valuable but again this isn't just Drupal specific the second thing is that Drupal has a learning curve and it takes a while to get to the point where you're actually saving time you will cross that cross that threshold at some point and at that point your time becomes much more valuable because you're getting more done in a shorter period of time you have more time to work with so again that's another thing that's common to most frameworks in CMS but here's where things get different with Drupal so in a lot of CMS when a major CMS is out there there's market places for modules and beams there's just established places to go to buy something to extend the functionality of those platforms then Drupal sharing is really encouraged sharing for free and more than encouraged it's almost abandoned it's not a choice so for example when I started working with Drupal so I built some modules to wrap around that functionality and from everything I could tell my only option was to put it on Drupal.org so I did and a couple things happened as a result first, people started telling me how horrible my code was so I had some comments about not meeting coding standards and security flaws and stuff like that so in one sense that's criticism but if you look at it another way that's free mentorship people telling you where the caps are and your knowledge and those people that need those comments people I still know that I still have relationships with so the other thing that happened is that people started using the modules and I started getting comments like hey thank you so much for sharing this I really appreciate it, this is valuable and very few things feel as good as building something and looking really hard to be passionate about it and putting it out there for free and then having people use it if I have a process it's like it is the epitome of helping somebody so that's a wonderful feeling that sharing process feels really good remember the puppies and the baby yeah, you guys remember the puppies and the baby? this is a pause just to see if you guys are listening puppies and baby yeah so yeah that whole thing Drupal is puppies and baby it's just right out of the gate so part of this process of sharing means that you end up connecting with people who are using your stuff your peers, people that you can help and so you start to build this network and you know one of the biggest problems of freelancing is not having a network it's not having people not having a community well in this process of sharing you start to build this community and then you get exposed to tools like IRC where we just had an online chat where in any given time there's hundreds of Drupalers on there having conversations answering questions you can hop on there at any time and ask questions, answer questions just participate in the discussion and that feeling of just like simultaneously working with hundreds of people across the world just means a lot when you get that sort of solid tech feeling when you're working by yourself okay so working part of the process ends up beating this ability beats it down to a pulp and then that's supposed to be funny I'm not an aggressive person that wasn't real is all acting so there's also something that's unique in the Drupal space which is the network of events that happen so I went to the CMS Expo which is a place where a bunch of different content management systems and representatives I talked to a lot of people there and they all said that Drupal have this amazing community with this amazing infrastructure of events so we have Drupal user groups where virtually anybody can develop relationships with people that you can see on a regular basis and then there's Drupal camps where you get to maybe meet some of your Drupal heroes people who you have a lot of respect for that you know you get some face to face time with and then there's Drupal cons like this where you get to see this cross section of the community from across the globe and really feel like you're part of something special and really interesting so all of this face to time all of this physical participation with other people means that your online interactions become a lot more fun and so all of that helps to make you feel like you're part of something and that's a big deal for increasing your stamina to freelance even longer everybody following with that even if you're not so this is a really long list I'm so sorry but this is the last bit the skills that you build working with Drupal in your freelancing work are all skills that you can build when you work on a startup so this means that everything that you learn there can help you hit the ground running with your startup I want to talk more about that but first I want to talk about me a little bit okay so just a couple I'll summarize it there's a lot of information out there about me it's kind of a buzzword really popular and there's lots of nuances of it but the basic idea is very simple which is that the cheaper and faster you can build a product the more opportunities you have to fail which is a good thing because that increases your chance of success eventually right so it comes from two parts because there's two parts to our expenses one is human resources the people that we pay to do work and then there's the raw materials the stuff that we need to actually build the things that we're making so software is an awesome example of cheap because one you can build the skills to produce the software yourself so you don't actually have to hire anybody you could but that tends to make it more expensive there's a very few raw materials that usually come into play with software you can even put it out there for free right so software is really cheap it fits the bill that way the faster also has two facets two facets to it the first is that the more skills you can insight into a market that you can bring to the table when you begin creating a startup the faster you can produce it because you don't have to ramp up you don't have to do the research you don't have to build up the skills but a faster, which I alluded to earlier is the idea that you want to put something out there as quickly as you can before it's perfect because you have some ideas of what the market wants you think that you know but none of us know we just have some ideas so it's better to not spend a bunch of time trying to build something perfect because when we put it out there people are going to tell us that there's too much of a particular thing so if we can put it out there fast get feedback then we can iterate through the process of creating our product until it becomes something that fits the market like a glove so we can put a bunch of feedback that's good one of the epitomies of a non-lane startup might be a restaurant I've known a couple of people who have tried this the problem with a restaurant is that it's expensive so anyways so I know in a couple of people who have started restaurants it costs like $100,000 or $200,000 maybe more to start a restaurant which means that most people their life savings or that's at least the savings that they're going to use to try something so they get one shot at it and there's so much you can't anticipate there's so much out of your control you don't know if another restaurant's going to pop up that's going to be cheaper and better you don't know for example I lived in this really small town a friend of ours put up a restaurant called So Healthy which was really awesome for her to do but this was a really small town where it was all diners and stuff so it did not fly so one shot you could do it wrong and that's it where you can keep going until you get something that works alright everybody got me okay so what good is RuPaul to startups? so the first of all first of all like I mentioned before all the skills that you build all freelancing you can use while you build your startup and there's a lot of options that you have in terms of what kind of products you build so you can touch on virtually any industry with software and you can build software as a service you can build information portals you can build educational tools like I did you have a lot of options to choose from and even if you decide that RuPaul isn't the software that you're going to use for your potential product because some people don't some people will use something else because they have a different talent pool available to them or something you can still use RuPaul to rapidly prototype because you're really once you get really familiar with it you can just quickly try things and even people who are programmers can rapidly build interfaces and model data things that are really challenging to do they can do from a website but if you've been freelancing and you've done websites for a lot of people you know where you can spend a lot of time and it doesn't make sense to spend that time so you have to pass forward through that whole learning process and build your site really fast and really well RuPaul is unique because we have developers and we also have a lot of people who just use RuPaul and those people who just use RuPaul represent all kinds of markets so that when you're at RuPaulCon if you just stand around and you just introduce yourself to random people you're going to make connections in all kinds of different markets just naturally and you'll have something to talk about because we all do RuPaul to some degree or we don't do RuPaul and we can talk about that and so there's a connection that we have with everybody here and that means you don't have to be a pushy worker you don't have to be like hey this is what I do that will just naturally you'll naturally talk about what you do because you want to find out if you can help each other and so this community is really unique that way because we have both sides of the equation and you'll meet people where it's a particular problem so that's my talk I just want to leave you with one final thought which is that really any of us are capable of making transitions most of you have made them already but some of you might be scared or in the middle of a transition that's challenging so the takeaway I hope you have is that there are things you can do to cultivate joy and happiness in your life however hokey that sounds there's a science behind it and the more you can do that to weather those difficult transitions so feel free to evaluate this session if you liked it or didn't like it you have something to say also we have just a few minutes for questions feel free to bail too that's totally fine there's a microphone in the middle where you can ask questions also if you don't get the opportunity to ask a question I want to hear from you I want to know what you've thought about this anecdotes to add or things that I missed anything so I just want to say thank you so one of the key principles of lane startup is hypothesis is invalidating that and of course failure so when you were doing build a module what kind of failures did you have where you predicted the hypothesis wrong that's a good question so there's been a lot right but the one that pops into my head was a friend that had a lot of success with long form sales pages where it's just like text text text and you pull someone into a story about how amazing whatever it is you have is for them so I tried that I switched out the homepage instead of being like links to videos it was just this long sales letter with like a sales pitch at the end and when I looked at the analytics after doing that and so that was just you can try a lot of things rapidly with your site that was just one thing that I tried but I've tried a lot of different ways to organize stuff on the site I've tried different ways to market things like one time I built this backpack that was at my booth on events with this build module flag and stuff just thinking I don't know maybe this will help people learn about it or ask me questions or something so those are a couple of things yeah thank you very much while you had a solo investment so that's something I've stayed away from because it scares me a lot so I built a module by myself I don't have any partners I don't anticipate having any partners with it I don't have any employees either so I kind of run solo because I feel like I get the most satisfaction myself in working that way having to consult anybody about it that's good to me and so those people can be really successful forming partnerships and an investor is just a partnership it's someone who's saying here I'm going to give you money and maybe expertise and ideas and in return you'll help you're going to make this succeed or do your best to do it and so for me I've always stayed away from it because I don't want to be stuck in a relationship that's going to make me miserable for a long time but I know people who have had a lot of success at the on at the on has a lot of investors and as far as I know they've been really happy about that relationship and so there's success stories out there and so it's kind of, I think personally you have to kind of know yourself if that sounds good to you if that sounds exciting then do it if you're doing it just for the money like you might find yourself in a hard place later that's my thought your start-up is it's essentially a product which seems to be a little bit more easier to apply the principles of lead start-up to a product opening purely services in your community you sell billable hours how to apply those same principles of lead start-up to that services yeah so I'm, you know, as you know just hearing this my experiences are really limited so all I have to talk about are my thoughts and also other people I know who have done these things so the people I know who have been the most successful running web firms for example they figure out what the system is to basically make their services a product it's not like sold the same way you're still selling it as services but you build it as something that sustains itself that you don't need to be in there so some people I know have development firms that completely run by themselves so I think that's the goal at that point it's sort of I mean in a way it's sort of a productized service because you're able to expand it time yourself so which I think is the ultimate goal just a quick follow-up but it seems like it's harder to apply the principles of fit and fast when you're like a company buys it for weeks but a project may a service may take six months, 12 months to deliver so I'm going to give thanks for learning in a good way yeah so most people I know they start by doing it themselves they figure out certain processes that work with one person and they bring another employee which is a big deal that first employee is a big deal and then the processes have to change you try to offset, you know, offload as much as possible to the employee and then you continue to expand and evolve the process as you go and at some point you have the right number of people to take over every role that's needed for that to work so it's a process so if you start doing that I think that would be really hard I can't imagine a lot of people being successful with that right away that's kind of a one-shot deal because you're hiring a bunch of people and you have all this payroll it's really expensive so that's the iterative process it sounds the same to me as the lead bank you start small you put something out there and you evolve it until you have a bigger team that's giving exactly what's needed and you put a website out there and these clients started going to it can you describe that the transition or, you know, what drew them to it and how you made that transition to freelancing like to doing freelancing work or put the website out and clients started coming to it yeah so there are two points where I put a website out and things changed one was when I went into freelancing and then the other was when I got the prototype to build the module out so with the freelancing side are you more interested in the transition into freelancing or the transition into the startup okay, okay so my website actually played a big role at the time because I learned everything I could about SEO I could look at the local market so I could come up for web development in Idaho there wasn't a huge competition at the time I think it's a lot harder everywhere now to make a tent in that to begin with so I ended up getting some leads through that most of my initial leads were from direct connections so I just go to different networking meetings anything where there was going to be people like I went to recommend people but the website eventually played a big role in those leads but it was a lot of SEO showing up in a search engine so I didn't do a lot of paid search engines stuff but I put stuff I tried to build a small portfolio first websites were long although those for friends and things like that have something up and just randomly people would just would call and get some jobs that way I don't know if that's answering your question that's good I think I just have a quick comment toward the last question I'm trying to change or to frame your services as a product I was actually talking to someone in the construction industry and it kind of seems obvious after I have those opportunities to fail frequently throughout like something like a six month project awesome comment yep so yeah I see that happened a lot it makes sense to break it up into sections that way you learn one do you have the skills and the resources to do it and second that's the client actually with the client action in the end alright so one more question actually I just had a comment also oh yeah I actually got my first actual employment gig like six months ago it was the first job I mentioned and as you said when you came back you were doing more like sub-contracting for some other shops so like first thing one of the things for me as a freelancer that was probably the most difficult not skill wise but just mentally and emotionally was doing the business management stuff getting work doing marketing doing invoicing tracking people down and getting them to pay I mean it's grueling and that's the cost of doing business that is not necessarily what we want to be doing so in the market now and hire somebody you can you can write your own ticket if you want a really smart thing to do is to actually go out and make contact with a bunch of different firms and say I'm not looking for a job or say I'm looking for a longer term contract in ten hours a week and setting up maybe a couple of those and then you get alright so thanks again for you guys for coming have an excellent rest of the Drupal Con