This presentation is called the Anatomy of PHP, a PHP request by Herman Radke and Joel Salas. Herman is a sociologist, turned full-stack engineer, turned VP of Engineering. He writes PHP during the day and is a Slashian at night. He spends a past of his life writing a lot of C and used that knowledge to maintain the PECL Slashman cache and the PECL German extensions. He is passionate about creating and consuming hyper-media APIs in particular how. And then Joel is a seasoned engineered and emerging engineering leader and employed at Nordstroms with the online off-price division. He has been using computers since before he can read. In the former live, he cut his teeth in the traditional CIS admin role. Nowadays, he is glad to usher in the age of DevOps and writes software to solve systems and platform systems and platform problems. Hi, everybody. Let's see, those come back up here. Awesome. So let's get started. We're gonna talk about the Anatomy of a PHP request. So those are really good introductions, but just to recap real quick, who are we? Joe and I both work for Hope Look, who was acquired by Nordstrom a couple years ago. We also built Nordstromrack.com. So that's sort of the context where we're coming from. Most of our software is written in PHP at this point. Again, I'm the VP of engineering at Hope Look. I've been there for six years. That's my information if you want to follow me. This fine dress gentleman to my left. I'm Joe Salas. You might remember me from yesterday. I did the Hoot performance, cracking the flash sale talk. And so a lot of the nitty-gritty stuff we didn't get to yesterday. We're actually gonna revisit here today. You can tweet at me on Twitter. You can post request me at Good Hub and you can email me at Gmail. Thank you. So let's get into it. We're gonna talk about anatomy here. So a quick definition. For context, this talk actually was sort of the precursor to the Hope performance talk. So if you saw that one, we're doing it in reverse. But we're gonna dig into the internals of what a PHP request and that request lifecycle looks like. And we're gonna get into some of the internals on how that's structured because they're closely related. And we can think about it a little bit sort of like human anatomy, right? We're not gonna sort of extend that metaphor too much but there are different sort of parts that make up PHP and the request while working in concert. It's just similar to the human anatomy work. So let's get into the process lifecycle first, right? So you can see here, we have a diagram and the orange section represents a PHP process. Also known as a PHP worker if we're actually running it. And inside there's a blue section who sections the request lifecycle. And we're gonna go into detail about this but just from a high level, there's sort of formate steps, right? We have a module initialization step. We have a request initialization step and a request shutdown and then a module shutdown. That happens around your actual user landscape. And then we also have, let me drill. We also have the PHP internals. And what this looks like roughly is we have sort of four main boxes here, right? So we have the SAPI top which are sort of our survey API. We have extensions, we have core and then the ZenTube engine. So when we're working with PHP, a lot of the time we will actually be, not just running PHP raw code from the command line, we're actually going to be using PHP in the context of a web request. And so some basic understanding of HTTP here is pretty important so that we understand that a PHP request doesn't really leave an isolation. It's going to be bound pretty much on both sides by something that speaks HTTP. For example, the PHP prior to seven do not have a built-in HTTP server so you can't just run PHP as a process and have it listen to HTTP requests and speak that protocol. And so what I'm gonna focus on here for a few minutes is the server API or SAPI part. And so when we're dealing with that, we're talking about a couple of two main ways to run a PHP service on the web. We're gonna be using either ModPHP which is a C extension for Apache. And so that is some C code that is written, that hooks, sorry, the web server hooks into when you are running a web request. And the other way, the more modern way, the way that Holtlook does it, is going to be the NGINX proxy to PHP FBM through the FastCGI protocol around CGI protocol. So again, we're visiting this. The interactions in blue are bounded by the web server. So whether we are initializing class executing PHP, all of that is between the web server's interaction. So let's begin to learn more about what ModPHP does. Touch on this a little bit. But who here has actually set up a web service, WordPress or something like that, using ModPHP with Apache? So that's almost everybody in the room. So this is an extraordinarily common way to run a PHP service. What are the issues? I say yes. Let's look at what that might look like in a sort of system diagram. So the black box represents the Apache web server. And these three fellows should look pretty familiar right now, they are of course PHP workers. And so the way this works is for every single Apache worker thread that is serving HTTP requests, you're actually bound into the ModPHP C module and that will run PHP code. And so the nice aspect of this is that a lot of people don't actually know the difference between what Apache is doing and what PHP is doing because it's so tightly integrated. And that can be problematic because it can be difficult to help people debug. Are you having a problem with PHP? Is it a web server problem? And again, this is I think where a lot of people are not familiar with the boundary lines because ModPHP really blows in a lot. And so it is again using the server API directly. So what are some problems with this design? The problem, one direct problem is that you need one worker to serve every web request and you are loading PHP for every web request. So is every web request PHP related? I imagine if you put everything correctly that answers no, you're gonna be serving all kinds of static assets, flat HTML, your NEP and geographic stuff like that to sort up the markup of the page. And that's not all going to necessarily have to be fed from a PHP worker. So this actually does not scale all that well. It uses lots of memory, uses lots of CPU and it actually falls over pretty easily. So now we do something a little different. This is the sort of fast CGI or FPM model. And if you're running with Nginx, you notice that Nginx is hard. And it's hard to get Nginx going with WordPress. If you're used to ModPHP, it just works, right? You just like get install PHP and installs HTTP for you and you have everything you need out of the box to run WordPress. And so once you get to Nginx, it's a very different beast because it's kind of hostile. And so the Nginx supports really forces you to understand the difference between the fast CGI server and the Nginx web server. So here we can see a couple of worker threads and they're running, speaking of fast CGI protocol. And Nginx, we should actually see some HTTP traffic coming in here from your right. And the traffic comes in, comes right back out. The fast CGI response goes to Nginx. Again, you can't talk to the fast CGI server directly with the web browser. You will get garbage because it does not know what HTTP is. So the black box there is actually the boundary of the fast CGI process manager. So who here remembers the old and horrible days of FCGID or something terrible like that? Great, yes, those are dark days, right? And part of the problem was that the fast CGI ID, all you could do is tell it to run a certain number of workers and it would spin them up. And so if your Nginx web server is all of a sudden under a lot of load, you're shooting tons of CGI requests of these things and eventually you're gonna get some dreaded, dreaded gateway timeouts because what is the gateway timeout? Like gateway, okay, okay. Like a router? My router's gonna have no. It means that Nginx is trying to speak upstream to the fast CGI server. There's nothing there to service the request. And so it's actually gonna return an error to the user or cause a cascading or somewhere down the line. And so nowadays we use the fast CGI process manager which will run a pool of workers. It will track them. It will keep them alive and healthy and happy and it will actually kick them if they die. And you can actually set a dynamic scheduler there. So you can set a minimum of five workers, let's say a maximum of 40 and you can have them scale up and down dynamically based on the number of fast CGI requests coming in from the web server. So this is arguably a better way to do things. So, cool. So we have some context about how we're like providing stimulus to PHP, right? It's through the context of a web server. And even if we're in the, a CLI sort of context, when you make a command line request to PHP, so like even PHP dash H, you really are sort of following that same step.  So actually actually they peer in a little bit more into the internals of PHP here. And let's first talk about the Zen 2 engine, which is sort of the underpinning of PHP. So this Zen 2 engine sort of has three main roles. It's a compiler, so it takes your PHP script and it turns that into ICODE. It's a virtual machine, a virtual machine that is able to take that by code and execute it. And it also is a memory manager, so it's able to allocate resources. And you can think of that sort of like the brain of a PHP process or request. And then next we have core. And core really has two main focuses, it's network IO and file IO, and then request management. Request management in the sense that this is where your main sort of other program comes in and it's sort of gonna pass control off to the SAPI or to the extensions. So extensions really is where all of the functionality of PHP comes in. And as we saw a few minutes ago, extensions and modules are the same thing, so we have to initialize all those things. So when you actually look at a PHP source code, you'll notice a folder called ext, and that's where all the extensions are. And there's like 30 or 40 in there. When you build PHP, all those are built into PHP, automatically, statically compiled. And that's where all the functionality, like the standard library, quote unquote, of PHP, that's where all that lives. Everything from like math to JSON to MySQL, it's don't confuse it with the standard PHP library extension, it's quite confusing, but all this functionality statically compiled into the binary, and when the process starts, all these are initialized. And there's also another kind of extension, which was the PECO extension, or PHP community library, PHP extension community library. And this is where extensions like Memcache and Mongo and Redis exist and Gearmin exist. And these are normally dynamically compiled into shared libraries, DLLs or .so files. This is really nice from an operational standpoint because you can sort of include these or remove them from your servers without having to rebuild the entire PHP executable. So up until this point, like we really haven't been able to actually make a request to PHP yet, we've been sort of setting everything up. And so, we're up there. What we normally sort of start at is our index PHP file, right? Like a lot of us run an NBC framework. So in order to execute that get request, the first thing we're gonna do is initialize our modules.  And PHP, as we all know, uses INI files for configuration. So PHP's gonna go through and look at all those INI files, whether it's PHP INI or using the PHP.D with all your extension specific INI files. It's gonna figure out what extensions that you have either statically compiled in or that you're dynamically loading into the process. It goes through every single one of those extensions and it gives it that callback. And we call that M and N, or module and N. And again, a module and extension is sort of an interchangeable thing here. So during this extension startup, the process has started and we're gonna sort of define things here that are common across requests. So whether the common things are cross requests, these are things like constants. So you might think like the JSON extension that's statically compiled in has like a bunch of different constants like the JSON hex tag constant. That actually is only like sort of defined constantly during this process startup. It doesn't sort of exist sort of just in PHP itself. We do other things such as I have to actually specify what classes exist in PHP that are part of your extension. So the way PHP 5 works, your extension only knows like C functions, right? You have to actually map like, hey, this object state, like this class method with object state maps to this sort of C function and you do that during modules initialization. You also register resources. So I'm sure if anyone has sort of like a VAR dump on a MySQL database connection, the type is resource. You have to register those resources at this point. And you're gonna register stream wrappers, but I can go too much on those. And you can also register globals. And so you might wanna do this if you need to actually have a global variable with some value that's common across all your requests. So you have an example of this while like this might be useful. So who here is using Redis for session storage, any kind of database type stuff, key values, great. So who is using Redis with PHP? Interesting. So hopefully you are using Redis in an HA fashion, meaning that if one of your Redis servers dies, your PHP workers don't utterly bomb. But one of the things that we can do in this eminent phase and one of the best examples of how that works is actually Redis Sentinel. Is anyone actually using Redis Sentinel in production right now? Interesting. So to be clear, we had some trouble running Redis Sentinel for a number of different reasons. But when we took a crack at it, it was not very mature, we were using Memcache. And so our eventual solution was Couchbase. But let's go through the Redis example here and let's talk about it. So what is Sentinel? Sentinel is an HA option for Redis and what that will do is maintain all of the typical things you wanna know about a cluster, like which of the members, which ones are active, which ones are inactive, it will handle failover and it tries to allow the clients to be good customers of the data store. So first thing we're gonna do as an example here is let's create a global variable to track the Redis server. So in our Sentinel code or however we want to manage the Redis extension, we're going to keep track of that Redis server. How we find that Redis server is not super important yet but you can sort of assume that Sentinel will actually provide us this value. So if that fails, we're gonna query Sentinel again and find the Redis server that we can actually talk to. And then finally, we're going to persist that value across multiple requests. So in other words, that becomes a global ineminent and as we establish, eminent means that it applies to every single request after the PHP work has been initialized. And it's important to note that there is a difference between the worker and the request and there are some frameworks or one times it would have you where this distinction is not very well maintained. But in PHP, you can be pretty sure that if there was a 500 or something like that, the worker itself is not gonna come crashing down. Your request might return a 500 or it might bomb for some other reason or a memory but the worker itself is still basically intact. And part of the reason is that the eminent process does maintain some state between requests. And so there are actually some problems with this design. Remember, we're trying to query Sentinel to know which servers are available, which ones are not. And at the same time, we're saying we're gonna persist this in some sort of in memory store, right? So this becomes a problem if our configured Redis server is actually unavailable after eminent. So remember that little blue chunk of the diagram are actual requests coming in and coming through. And so eminent happens before those requests are actually being executed. So in other words, this worker after the server is down will be stuck until you go in and you hop it or the process manager is hopped or what have you to clear this value out, query Sentinel and talk to a new Redis server. And so this is actually the problem that prevented us from deploying Redis into production. So it's part of the design problem with Redis. It's also a design, part of a design issue with PHP itself. And so there's good reasons and bad reasons to do that. But this is one limitation that we've certainly encountered. Yeah, so after eminent, the next phase is our net or in other words, requesting it. So in requesting it, this is actually where we actually get the property of Joe, which I touched on is where every single request that comes in, it does not affect any other requests that are currently being served out of PHP, FPM or the existing Apache plus mock PHP setup. So if one of our requests sort of blows up, I think it's affected. So we could have a scope operating environment, right? And then just like eminent, every extension has the ability to set a callback for requesting it. And so you can loop through every single one of the requests extensions again and sort of ask that extension if they want to do something in this phase. This is actually kind of really interesting if you know PHP has an auto prepend file sort of configuration where you can provide some user land or just normal PHP code that gets prepended to every single request. It's kind of a nice feature. Some people use it. You can think of our net as sort of the built-in C level version of auto prepend file. So you can do some interesting stuff here. Some things like profilers or debuggers will use this to set up an environment. To kind of put that in perspective, like if you want it to, you could write in your R and it, you can basically start a microtimer and initially capture that value at that point and to be used later to sort of track how long a process took if you wanted to do that. So to this point, like all that we've done is sort of set up PHP to actually start talking to the PHP script that we want to actually sort of get executed, right? So that's where our actual domain logic exists. So if you type, again, you type PHPs hmini command line, you'd have done all this work to get to this point. So now we want to actually talk about sort of some of the execution phase sort of structure that PHP has. So most commonly people are using a MVC environment, maybe a page controller architecture if you're using a really old application. If you're in MVC, the most common thing you're gonna do is require some files and then you're gonna configure your application, right? Configuring your application is normally done with a nini file, xml file, or a JSON file and you have to do this every single time, parse that into some values that PHP understand and then pass that into your application. So none of this, there's no sort of coordinates in PHP to preload this stuff, to skip this sort of bootstrap phase. So this is sort of, we're starting to sort of do things, common things that we're gonna do every single request over and over in userline code. The JVM or Node.js, or if you're in Ruby with Puma or Unicorn, you can preload like your framework level or application level code so that when requests come in, you don't have to do this step and PHP, you can't do that. And so as soon as we start our application, our framework probably uses some sort of auto-order. Most of us, if we're familiar with PHP argument, using Composer, right? Modern frameworks contains hundreds of classes. So at this point, once your application starts starting up and it wants to get sort of the foundation of the framework loaded, it's going to be going through and try to auto-load all these different files. So auto-loading is really just include or require underneath the hood. And if we're sort of following PHP conventions, we normally have one class per PHP file. So the auto-loader is now loading up all these different files. And that means we're basically doing a stat or an F-stat against the file system to basically see if that file exists where we think it exists and then load it up. So it's a lot of work against the file system. This only exacerbated if you use a PHP directive called include paths. So I'm sure most of us have more than one include path. So you could actually, if you have 10 include paths and your framework codes at the end of that include path, you could be doing a thousand different requests to the file system just to sort of get your code into a state that the framework's loaded up. So you can actually start doing your specific domain logic. And not all sort of libraries follow the PHP sort of auto-loading conventions of PSR zero or PSR four. And if that's the case, we can sort of use this alternative thing, which is a class map, right? And class maps are really just normal PHP code that has an array where the key of the arrays, the class name and the value is the location. So this actually can get around some of the penalties of auto-loading. We have an absolute path to the file so we don't take an include path hit through lowers the amount of times we're statting the file system. And since it's just normal PHP, once we load it up once for that request, like it's there at key value, a key lookup in an array of PHPs is the hash table lookup. That's constant time, it's very fast. You don't want to overdo this the right because if there's 10,000 entries in this array and you're only using like 10% of them, that's a lot of overhead. You're loading up a PHP file and you're only using 10% of it. So class map can be used for things, PHP unit, for example, doesn't auto-load very nicely since Sebastian didn't sort of build the structure of his code in a way that made sense to PSR zero or PSR four. So class map works really well here.  So at this point, we're probably thinking like PHP is a pretty bad way to serve web requests. All this seems really slow, but we can do a couple of things. Yeah, it's looking at dark days for PHP, right? Who, after sort of watching all of the stuff that we're gonna do on every single web request, would still write their app in PHP? We've got a couple of die-hards, but yes, it is doing lots and lots of extra work and like I said yesterday, PHP is very CPU hungry, but what about upcache? Hopefully you are all using upcache, as everyone familiar with APC, the extension, and everyone loading that up, great.  So what are we doing with the upcache? What does that actually mean? What can upcache possibly do in this routine to actually make the situation better? So what the upcache will do is actually load up the, as you run a web request, the very first web request through the system will actually create some in-memory operation upcode caches that every subsequent web request can reuse and therefore it's sort of exploiting nice warm cache of code paths to use so that you do not have to trash all of the nice objects, maybe that you've loaded into memory or have you. It actually does not pop in on an object level, but it's gonna be a little bit more level and it's going to optimize the most commonly used parts of your code. So let's take an example. Let's write a simple PHP script here. It's going to echo hello scan and let's look at what this might end up looking like if we were to dump out the upcache in the middle of a server request here. So this is actually pretty straightforward. Sign hello, press scale, echo, return null. So this is a pretty simple representation, but this is a very clear way to see that as we tick our PHP code, which is meant to be dynamic, we're actually turning it into something static in the upcode, I'm sorry, in the upcode cache. And that is a trade-off, of course. We're losing some of the dynamic features of PHP where you could possibly edit something on the file system and see results immediately. But the benefit is that things can be anywhere from 10 to 1,000 times faster depending on the code path that your application takes. So again, what they remember, upcache is global. So this affects every single web request. So if, for whatever reason, the upcache needed to change between requests, you're going to either have to go into the upcache manually because it's a very painful process, I do not recommend trying it, or you're going to have to hop the worker and let it re-go through the entire eminent R&D process and execute the code again before the upcache is cleared and ready to go. So I can think of about 10 different ways that this can bite us. Deployments are one. So if your deployment scheme consists of copying a tarball and untarling it, that's not going to cut it. You need to kill the PHP process and that might incur some sort of minor downtime, right? So now you need to plan around the HA just to make this upcache thing work. So this requires a little bit of planning but I absolutely think it's worth it. So another thing that you're going to want to get the upcache flatten your config files. This is huge. So as you mentioned that config files are typically going to use are going to be an INI file, maybe a YAML, probably a JSON. And your PHP code is going to have to go through this, parse it out and try to make some sense of it for every single web request. You cannot upcache a JSON file. You cannot upcache a YAML file but you cannot upcache a PHP file. And so what a lot of web frameworks will do is something called a cache warmup phase. Do you have any symphony users in the house? Great, so we've got like one or two hands that I can see and so as you are well aware, either on a first request or using the cache warm symphony console command, you're actually going to create a temporary directory particularly to the symphony environment that will contain a large number of PHP files and this is basically parsing through your parameters that YAML or whatever the rest of the config is and writing out some PHP code that the opcode can cache. And so this is extremely important for performance reasons but again it's also something where if you change the config file, that's not a dynamic file anymore. You need to go in and clear the cache and out the process to clear the, to edit the config file, recompile the PHP on disk cache and then recompute the opcode cache and now you're actually serving all the requests again. So as we mentioned before, you can create a class map to keep track of all of the different classes that you're going to be loading to prevent false to the disk. You can cache the class map and this is awesome because if you have a nice well-designed class map that includes everything you need and not a lot that you don't, you can cache the opcodes around the class map and reach your classes a lot faster. You can cache file paths. So as you'll recall, you're going to be doing a lot of stat operations to make sure that the files are what we expect them to be because we're auto loading because we're doing convention over configuration all these other nice developer friendly practices. They're actually pretty rough on your system. So if we're caching the file paths, that means that we do not need to stat the file system every single time we're looking for a file. We can safely assume that the file didn't move and in a lot of cases, you'll find that if you go into your running PHP server and just start deleting shit, it's going to keep working. It will actually work for you surprisingly long time. In fact, you don't really need a file system after a while if you're running the opcache correctly and I'm not recommending this by any means, but the opcache is surprisingly resilient at actually doing real code, code paths when it's nice and warm and when it's well configured. So you can keep connecting to my SQL, you can keep using extensions. Your code at some point actually becomes somewhat optional. And one nice config option you can set for the opcache extension, which it is an extension just like everything else, set stat to zero, meaning don't run to the file system. After you load up all of the files, just never check it again. There are certain cases where it might have to check the modification time or maybe in strange cases, the hash of the file. Just don't do it, just never do it. And this kind of gets you into that scenario that I was describing where you don't ever touch the file system after the opcache is nice and warm. So great, so up until this point, we've not made it a lot of the issues with sort of bootstrapping PHP requests at this point. And we can get some decent performance. And so back to this notion of a request being independent. What we do on our request is independent of every other request. So our global opcode cache is gonna help us with some of the bootstrap time, but again, we don't have preloading for other things. So one of the most common things to do in our bootstrap is to actually load a connection to our database, right? We're using MySQL in this example. And one of the things that happens when you actually use PDO, which is PHP data objects and probably the most popular way to make a database adapter to PHP is the constructor actually makes the connection to your database, whether it's MySQL or Postgres or MySQL. So in your bootstrap code, which is sort of at the very beginning of your request before you done any domain logic, you're not making a network request to the database. You actually might not even need a request to the database at this point.  And you made a connection to your database. So the opcode cache cannot help with this sort of instance, right? This is outside that sort of balance of the opcode cache. You can do something like wrap PDO and sort of try to lazy load this, but it's important to know that this can be really expensive and sort of, but most people don't realize that this sort of is happening behind the scenes until we start having really bad performance problems because they don't understand that the sort of context with PHP runs in. Which is everything sort of independent. Nothing's preloaded. And we go through this sort of request life cycle every single time. So at this point, we've bootstrapped our code. We have sort of done some domain or business specific thing that's important to that request. And it's now actually time to get another response section. So PHP was written to template HTML. And it's optimized for that. So by default, when you start trying to return strings back to the webpage, you're streaming those strings back, which is great because if you're into performance, you're time to first buy it looks pretty good. But remember, we're in a HTTP context here, right? And so HTTP has a header section in the body and when you start sending back your HTML or your JSON or your XML, that goes in the body. But in HTTP, in your HTTP request, oftentimes you need to actually send back some headers. Especially if you are using a session or you wanna actually specify that your content type that JSON is, application JSON. So what normally happens when people use the streaming part of PHP is they get a sort of warning like this. And that's because we've intermittently actually streamed some content back. And we're already in the body section of the response. And once you're in the body section, you can't sort of say, hey, stop request, I wanna sort of jump back into those headers and add some headers. So, most of you may not know this, but PHP session handling is driven by cookies and cookie, a cookie is HTTP header. So if you run into this, you can get this from warnings, you can get this from notices too. So it's not just sort of intentional echoes or print statements that you have in your code. If you have a notice or a warning because you index and arraying correctly, you can inadvertently sort of block the ability to send back your cookie session header or run a similar important header to your application. So there's a way around this that PHP gives us, which is to buffer our output. So OB stands for output buffering. So what happens here is inside our PHP process, we can actually dedicate some memory to start storing the values into that buffer before we send it back to the client right away. This does slide on the type of first byte because we're not shooting it, but it also gives us the ability to wait until the very end when we're actually already to start responding. We've all set our headers correctly. Now we can start sending our body back. This is really useful too because we bring in a lot of different libraries with things like Composer and stuff. And you don't want sort of one misbehaving library to accidentally write something out and sort of wreck the rest of your request and sort of be trying to figure out what happened there in real time. So in this example here, we can start the buffering and you actually can do a lot more configuration with output buffering and flush is sort of ending the output buffer, ending the buffering and then flushing it out to the client right away. You can have a lot more sort of configuration. You also can kind of stack this too, which is pretty nice. And so at this point, once we're done with our output, our request is done and we're entering the request shutdown phase of the lifecycle. You can think about our shutdown here as sort of the opposite of R&D in that it's auto append file. The nice thing about our shutdown as opposed to auto append file and user line code is it's guaranteed to run. So if you ever have tried to use auto pre-con file or auto append file, you will notice that if someone just sticks an X or a die in their code and you're using auto append file, your auto append file doesn't actually get added, which shouldn't be quite annoying if you are really depending on that code to run. So if you really actually need that to run, you can stick that in the R shutdown phase and see. But this also is important because PHP at this point is freeing the scope environment. It's freeing up all that memory. This can be leaky at times. If you have cyclical references, sometimes PHP can't free them, which is not good. And this is why I'm first conscious about how Apache and the fast process manager work. They only sort of let so many requests run through that process before they'll tear it down. Like you'll bring up your process, allow a request to be sure that you'll tear it down. It's because we don't actually capture all of that memory that we allocated back, back to the Apache or FPM process or the file system. So we sort of need to free that up. Not much else interesting goes on in R shutdown. Most extensions don't make too much explosive use of it, but it is there again. Every extension is sort of called during that phase. And finally, when our process is setting down, we also have a hook for M shutdown. M shutdown is really just again, freeing all that memory that the eminent had. So if you actually did register globals or you did register resources, you wanna free those all up as well before you just lay that memory out on the floor. So real quick, to go back, PHP really has sort of four things it has to do before it can execute any sort of user line code. And there's sort of two related life cycles. The first life cycle is our module initialization or extension initialization and extension shutdown. And the second cycle in there is a request initialization or request shutdown. On end and R shutdown are gonna happen many times per process and typically eminent and M shutdown happen once per process. And also PHP is made up of four basic building blocks here, right? The Zen 2 engine, which is what the engine that runs PHP5 is. The core, which we really don't actually get much into and then the extensions and the SAPI. So we're at the end of our talk here. Does anyone have any questions? Yes, sir? Yeah, so HHVM is interesting. It probably is quote more analogous to the replacing of the Zen 2 engine. It still has SAPI's, it still has extensions and it still has a core. And if anyone here is not familiar, that's a Facebook sort of answer to a better way to serve PHP requests. Under the hood it'll compile things down to C++. There's a couple of obstacles to try to move over from PHP to HHVM, which is a primarily being that extension part. But the lifecycle actually is much the same.  So now you're introducing this concept like a threading model, a concurrency model inside of PHP requests. You don't typically have when you're running like the Zen 2 engine, right? Like you can run threaded workers in PHP, I think he will do that, but most people don't really run threads in their PHP userline code. You can kind of start doing that in HHVM. So it does violate some of this what we talked about and you do have to write the extensions custom to HHVM there. But it's fast, it's really fast. And I think it's sort of PHP's built to make getting a web application up and running pretty easily from an operational standpoint, right? Like that's the whole idea behind it. HHVM sort of trades that ease of operation for like speed, what you got to have it baked in. So I mean it depends on what your tradeoffs are. We all look, we have moved over to HHVM yet because there is sort of like a beauty to be able to quickly sort of deploy new software. And we've sort of able to kind of kick that can down that road as much as possible. But if we needed to optimize more, certainly that would be something that you should look at. And specifically if you're implying why are we not using HHVM, the short answer is doctrine. So who knows what doctrine is or who uses doctrine? So for whatever reason, the doctrine test pass on HHVM but when we try to use it, it bombs. And so instead of digging into why doctrine is bombing on HHVM, we're like, you know, we're actually gonna write some software that makes us money. That's why we have not touched HHVM for now. Any other questions? Yes, sir. So the question was in the PHP init process, when are the extensions loaded for a worker? And the answer to that is they're not loaded for any particular worker. They're gonna be loaded when we initialize module in a minute and that applies to every worker. So yeah, so you're gonna first do, your worker is a process, right? So Apache or FPM? FPM's easy because it's just PHP. So FPM is gonna create a new process. And when that process gets created, you first go into core, which is your main. And what main does is it basically says, hey, I'm gonna start the init process. And it goes through and it says, hey, I'm gonna look at my INI file. I'm gonna go find out every extension that's been registered. So there's a lot of extensions that are baked in by default. And they also go about that entry in your INI file where you have extension equals like memcached.sl. So it reads all those. And then there is some magic that as internal like some extensions, I think like EXT standard has to be loaded prior to all the other extensions because it's just PHP magic. But after that, it's kinda just okay, go down like this list of extensions and call that eminent on it. Once that minute's done, like that extension is registered in PHP. PHP knows that it's there because that's part of that eminent process. And so you actually can, a lot of times what you'll do is you'll register a constant that says like this is the version of that extension. You'll register a constant about the constant about the name of that extension. And you can kind of even ask like PHP-m right or PHP-i that I'll list it off that point. Yeah, so it's not done before the worker is created. So a worker in a process are gonna be equivalent. I think that's the key. So like if you think about it at HOTELOOK, we do the flash that like ADM, right? We're doing tens of thousands requests a second. And if we have a request worker that basically, that's a hundred requests go through and then it gets reaped by the process manager and it starts up again. Like we're actually reading processes at a pretty quick space at 10,000 requests a second. And there really is a, after a while you start to feel the tax of 30 extensions loaded up in PHP, even if they're statically compiled in, you start to go through 30 or 40 eminent callbacks. And those eminent callbacks are doing work, right? They're registering, they're allocating memory. They're registering constants. That's the out memory allocation and the class registrations memory allocation. So it's doing a fair amount of work to sort of bootstrap the process itself before it can even start serving requests. Correct, yeah, I think I forgot to mention that. After eminence is done, you're basically in a spot where you can now serve a request. You can, you're listening for a request at that point. And I'll leave. Yeah. One thing I wanted to add to that is if you actually go into your at cphp.d or whatever the directories and your distribution, you'll notice that all of the extension config files are named like encrypts and so on and so forth. And some of them on distributions will be prepended with a number. And so what that does is it's just alphabetical and that's how it loads the extensions. And so the extensions that must be loaded first will be, you know, zero, zero, or 10 or 20 or what have you. And so the distribution containers actually know which extension need to be loaded first. But if it wasn't for that, it would basically be tribal knowledge where you'd have to know, oh, you have to load that one first or you're gonna crash every time. Yes, sir. So the question was, when I say that we're gonna flatten an INI file, like what does that mean? Right, so an INI file is chock full of, you know, keys and values usually. And again, the point is that the opcode cache cannot optimize for that INI file. And so what we're gonna do is we're going to write out some PHP code that embeds those values into the code. So it basically is inlining all of the values that you're going to need. And this is actually gonna be particular to each framework. So this is some pretty low-level framework code that you're talking about, whether it's Zen or Symphony. Those developers have maintained a way to take a config file and pre-compute a PHP level cache. Yeah, we ran into that for the early days.  And then you can make sure that your code loads that file up, that PHP array, instead of parsing the INI file, that PHP array will be saved in the opcode cache. So you might flatten it. You're flattening from like this, you know, an INI format into this native PHP format so the opcode cache can save that PHP code. And then you can sort of sidestep the whole parsing in the INI. And then it's there like in opcode cache memory for the next request. Yeah, you could. If you wanted to add eminent, you could write a custom extension at eminent to load those INI values into memory at that point. And you could serve them out that way because you can expose those values to a huge amount PHP. Yeah. You're getting into like Yahoo, what Yahoo did for many years and what Facebook did for many years before they wrote hip-hop. That's basically what their strategy was. Yes. Yeah, so we're a number of us are in the process. So the question was, are we on the process of evaluating PHP 7? Yes. Yeah, so for extensions, they changed all the extension format, right? So there's actually a webpage that lists what all the state of the extensions are. I know Gearman was taken up by Co-People out of Etsy and they upgraded that extension code to be PHP 7 compatible. A lot of extensions that are sort of on the fringe have not been updated and that's a sort of, if you depend on one of those, it's gonna be, you can't upgrade. But the popular ones like Memcache D and Gearman and those are being upgraded and you could cut over. And it does change, like the internal, what we talked about here is basically the same, but they did a bunch of optimizations to really the ZVM to sort of make PHP faster and by doing so they kind of had to change the API with how extensions sort of saved values and interacting with user land come. And that's what a lot of the blocker is. So if we go back to our anatomy diagram, really we're talking about just that lower third of the picture, that's been the majority of what they changed and so all of the interactions that have to be reconsidered and redesigned. But most of the stuff that we talked about today is going to be valid in PHP 7. I'm very excited for it. I think it's a significant upgrade and it really brings PHP into 2016. I'm not aware of anyone that's using PHP 7 in production. I think a lot of the sort of PHP hackers went with HHVM and that might dramatically change with the right software. But we're definitely going to be using PHP 7 as soon as we can. Sort of took the best, it took the best stuff that hip hop did, HHVM didn't and put it in the PHP 7. So I think it depends on your workload, it doesn't have anything like benchmarks can lie, right? So I think depending on your workload, you can get a better perf boost over HHVM and some other cases HHVM can give you better perf boost over PHP 7. So I think if you are just looking for any sort of speed up over six, I'm sorry, five, because six doesn't exist. Seven's fine, like you should just do seven, right? Because it's easy. If that's not applicable to your workload then you may think about HHVM. But to PHP 7 is much easier to operationalize than HHVM. Just to be clear for all our purposes, like one of our applications, the actual time we spend in PHP is only 50 milliseconds and all the rest is external web calls and database activity. And so if we, let's say it was significantly faster, which in our case would be like 20% faster, we just went from 50 milliseconds to 40 milliseconds and it doesn't affect the number, it doesn't really do much. And that's really what you're going to see when you tune the heck out of your PHP, so. There are certain workloads that are not e-commerce related that will benefit significantly, like ETL, anything involving lots of data manipulation, not like SQL queries, but actually loading stuff into doctrine and dealing with objects. That's very CPU intensive and the initial stuff we've seen for doctrine on PHP 7 is very, very promising. Yes, sir. The question was, what tools are you using for profiling and debugging? I could probably think of at least 10, but the main ones that we use on a daily basis are going to be using New Relic for application performance monitoring. And so it has a very, very, it basically knows about Zen and it knows about symphony, so with almost no instrumentation, you can start getting stats on which APM points are getting the most use. Right, so the plugin is actually an extension and the extension writes to a small local demon that acts as a proxy up to New Relic. And so you have to load in that extension at a certain time, like we said. We've also used Blackfire to drill down into specific problems. So we use New Relic to find out where there could be a problem and then once we know where the code path is that has a problem, we use Blackfire to actually profile that application call and figure out why it's so slow. We've used XHFROF and XDBug in the past, but I think for the most part, New Relic has kind of superseded those. And honestly, if you're actually really trying to figure out what is going on with the PHP call, if your code is swallowing errors, like just crack out good old S-trace and just attach to a process ID and watch it go by and see what it's actually trying to do, we've uncovered a number of file system related, network related issues that way. And so in some ways, the old ways are the best ways in terms of debugging some of the stuff. New Relic actually is a Zend extension, so we didn't cover that in the talk, but it's super low level. Anybody else have a question? All right, I think that's it. Thank you very much.


The speed of light, a cloud of dust, and a hotty-high old silver! The lone ranger! Faithful Indian companion Toto, the daring and resourceful Masked Rider of the Plains led the fight for law and order in the early western United States. Nowhere in the pages of history can one find a greater champion of justice. Return with us now to those thrilling days of yesteryear. For a lot of the past come the thundering hoofbeats of the Great Wharf Silver! The lone ranger rides again! One silver! Let's go, big fellow! Are you still there? Bobby is a boy of nine. He can really hit that line. He's a star because he knows... Those vitamins and proteins that your body needs. Yes, indeed. A bowl of Cheerios and milk really starts your day off right. Does all sorts of good things for your body. Helps you have strong bones and muscles, good red blood, and healthy nerves. So every morning, take on a bowl of Cheerios and milk for real go-power. You like that wonderful toasted oat flavor too. Downright delicious. Come to think of it, Cheerios is one of the tastiest muscle-building foods you can eat. Try Cheerios and you'll hear... He's feeling his Cheerios! Here's paste the floor of his headquarters at Fort Drake. As he talked to his aide, Captain Vail. Help him here. Twice we've lost wagons bringing supplies and guns to the fort. I know, sir. The Indians seemed to know just when they were coming. That's it exactly. Someone must have tipped them off. Someone named this talk kid is a traitor. There's only one who might have the chance to pass on the information, sir. The Army scout, Pender, comes and goes as he pleases. I've suspected Pender right along. Of course we must have proof before we can bring charges against him. From now on, have Pender followed whenever he leaves the stockage. Yes, sir. Furthermore, I... I want you to send a courier to meet the three wagons we expect tomorrow. Give orders for the wagons to use the river trail instead of coming through the valley where the other two attacks took place. I'll send a courier at once, Colonel. And as you ordered, I'll have Pender watch from now on. One of those wagons is bringing a load of gunpowder, which we need so badly. Go to once and carry out my orders. Later in a grove on a ridge overlooking an Apache village, the Army scout, Pender, pulled to a stop. Oh! Oh, there! As he just muttered, an Indian stepped from the tall brush. Me not think you'll get here so soon. I left the stockade earlier and I intend to crowfoot. What's more, I'm not going back. Why you say that? They found out about me. I listened outside the Colonel's door, heard him telling the captain to have me followed. Well, I left in a hurry before the captain had a chance to do it. But how will you help Apache if you not go back to stockade? I found out something else while I listened. Three more wagons are coming to the fort. And the Colonel is sending orders by courier for them to stay away from the valley and take the river trail. When wagons come tomorrow, you tell Chief Big Wolf to have his braves ready to attack them on the river trail. I'll see you tomorrow, Crowfoot. So long. The following afternoon, the three army wagons moved slowly along the river trail.  Get on there! I'd like to know what the reason is for changing our route. The reason for what I'm going to... Starting the wagons were soon overpowered, falling under the savage attack by the Apaches. Some distance away, the lone ranger and his Indian companion, Toto, were riding along the river trail for the distant battle. He must have it! Listen! Hold him! Hold him!  Hold! Sounds like Indians attacking. All right, let's go. Come on, Toto! By the time the masked man of Indian reached the scene of the attack, the Indians had left. Hold him! Hold him! Oh, we're too late, Toto. Tracks show Indians drive away with three wagons. Take trooper's horses. We'll see if any of them are still alive. The two men went from one trooper to another, but none were alive. The lone ranger fought a moment, then spoke. Toto, the report isn't far from here. I'll go report this to Colonel Pierce. They want to see the bodies for identification before they're buried. Do you wait here until I come back? No, you wait. Come on, silly! The masked man had helped Colonel Pierce in the past and had no difficulty when he asked to be taken to the Commandant's headquarters. The Colonel greeted him as an old friend. I'm very glad to see you again. It's good to see you again, too, Colonel. But frankly, I brought bad news. Bad news? That's right. Briefly, the masked man told about the attack and of the death of the troopers on the River Trail. It's terrible. Do it once and take some in along to look after those poor villagers. Captain, order a squad of men prepared to ride at once. Yes, sir. We could hear the attack from a distance, sir. Those men didn't have a chance. This is the third attack in a month. The arrival of each wagon train was an army secret, yet the Apache is found out. Do you have any idea how, sir? Yes. An army scout named Pender. I'm sure he's the one who gave him the information. What makes you so sure? One of the other scouts reported that he saw Pender riding into the Apache village last week just before the last attack took place. You didn't have Pender brought before you? No. Yesterday I ordered dispatch sent, changing the route of the wagons. Also, I ordered that someone be detailed to follow Pender. He left hurriedly before that order could be carried out. He didn't return. He must have learned of those orders somehow. Left to tell the Apache side. I don't know how he could have. Anyhow, he left hurriedly. And now I hear of another attack. Your horse is running, sir. In the manner waiting. Very good, Captain. That's you. Right. Soon, the lone ranger with the Colonel and the troopers arrived at the scene of the attack. The unfortunate victims of the raid were sadly placed upon pack horses and the troopers started slowly back to the port. The Colonel lingered a few moments to talk to the masked men. This massacre is an outrage. We must put a stop to such attacks once and for all. But the Apache's greatly outnumber your men, Colonel. Yes, I know. I have simple reinforcements, but my request has been denied. Why? The general in charge of this area is new. He sent me a dispatch saying that to march against the Apache's enforce will cause a general uprising. Otto, I'll stay in this territory and do some scouting. If the Apache show evidence of making a move, we'll let you know soon. Thank you. I know I can count on you. I'll get back to the port now. Goodbye for a while. Adios. Yes, sir. You did well. What can we do now? Keep us coming. Otto, you keep close watch on Big Wolf and his brains. The masked man and his Indian friend made camp in a woods not far from the Apache village. That evening, they rode to the ridge overlooking the Indian village, leaving their horses hidden among the trees. They cautiously moved forward on foot to see what was going on. From a vantage point behind a large boulder on the ridge, they looked down. It looked like them whole pow-wow near campfire from the chief's wingman. I wish we could hear what's going on. Chief's wingman, near for the wooded slope. Be good down. Get close. Try here. What if they capture you, Toto? Then not capture me, Kimosami. You wait. Assume me to back. Silently, like a shadow, Toto disappeared into the underbrush. As time went on, the long winger became anxious. He knelt behind the boulder, watching intently and listening for any sound that might indicate Toto had been discovered.  Raise hands high. Slowly, the mask man stood and turned to face the leering, painted face of Crowfoot, who stood holding a gun. Me take you to village.  Big wolf be happy. Let brave use some ox on mask man. You drop gun. A long ranger had seen Toto move silently behind the Apache and hold the knife at his back. Crowfoot, taken by surprise, hastily dropped his gun. You nothing sound. Good work, Toto. We're tired and gagging. The mask man and Indian tied and gagged Crowfoot. When they finished, Toto drew the long ranger to one side and spoke in a low voice. We get close, Kimosami. We hear words of powwow. Go on. Soldier talk to chief. Big wolf. Him tell Apache to attack Stockade. He must be that army scout, Pender. When we get close, soldier talk to chief and other Indian. Tell him Colonel, send for reinforcements. Him say for chief to attack Fort at dawn. See, him have good plan to take Stockade. Chief agree to attack at dawn tomorrow. An attack on the Stockade now has every chance of succeeding, Toto. We must act quickly. Chief Big Wolf takes Fort Drake. Every tribe in the territory will go on the war path. The Clinton falls on the first act of our lone ranger adventure. Before the next exciting scenes, please permit us to pause for just a few moments. Cowboy Tom is a boy of six. He knows all kinds of cowboy tricks. He can rope the steer because he knows. He's got goats. He's got gopaw. It's a fact. Cheerios does give you real gopaw. You see Cheerios is made from oats. And every delicious spoonful of Cheerios and milk is real muscle building food. Each spoonful contains vitamins, minerals, and proteins your body needs. Yes, the good things in a Cheerios breakfast do good things for your body. Help you have healthy nerves, good red blood, strong bones, and muscles. And Cheerios is so much fun to eat with its distinctive O shape and its wonderful toasted oat flavor. So tomorrow morning and every morning start the day right with a Cheerios breakfast. Then you'll hear people say, He's feeling his Cheerios. Now to continue. Toto reported that the Apaches plan to attack Fort Drake at dawn. The lone ranger realized the serious result of such an attack. And knew the situation called for quick action. And what we do, Kimasaki? First, the Colonel must be notified, Toto. I'll go to the fort. I want you to ride to Fort Davis 15 miles west of here. I'll give you a note to Major Norton. Ah. And what we do with Apache Bray, we tide his horsegounder in trees. All right, I'll take you to the stockade with me and turn him over to the Colonel. They want to question him. Hurry, Toto. Bring his horse here. We have no time to lose. The lone ranger and Toto hurriedly tide Crowfoot to his pony. Then the mask man rode with him to the stockade while Toto started to Fort Davis. The prisoner, Crowfoot, solemnly refused to answer questions. And Colonel Pierce was worried when the lone ranger told him the news. We're in bad condition here to ward off such an attack. If that gun putter had come through, he might have had a chance, but now... I sent Toto with a note to Major Norton at Fort Davis, Colonel. I explained the situation fully. I hope he sends reinforcements. And that they come in time. I hope so too. You mentioned that Toto heard Pender say he had some plan to help the Apaches take the stockade. I wonder what he has in mind. Well, I don't know, but I'll try to find out. I'll leave the stockade and do some scouting. Your old presence gives me some hope, my friend. I'll give the necessary orders to the men. Meanwhile in the village, the Army scout Pender was telling the Chief his plan. Chief Big Wolf, wagon is ready to roll. Oh, you tell me why we take wagons, stockade? Sure, sure. Your graves left three kegs of gunpowder in the wagon. Well, I attached a long fuse to those kegs. That's the fuse hanging over the seat. Now the ground in front of the stockade slopes down from a low ridge right to the big gates. We'll take the wagon to the ridge, stop it with the back of the wagon toward those gates. Then we unhitch the horses, light the fuse, and start it rolling down the grave. It'll land against the gates. The gunpowder will explode and blow them open. Then you and your graves ride right into the stockade. That's a good idea. Those soldiers are sure in for a big surprise. During the night, all preparations were made at the fort to stand off the expected attack. Just before the approach of dawn, Colonel Pierce stood on the rampart by the big gates, talking to Captain Vale. Well, Captain, it'll soon come. Frankly, I'm greatly concerned. We can't hold them off very long unless we get more gunpowder and reinforcements. I'd be satisfied with the reinforcements, Captain, but... See, what's that standing up on the ridge, Captain? It looks like the back end of a wagon button. By the thunder, that's what it is. Do you see anyone near it? This dim light, it's difficult to see much, sir. I will see... Wait a minute. I do see some figures near it. I'm sure they're Indians. But the wagon, I don't understand. For a short time, the two officers stood watching the ridge. Soon it was light enough for them to see quite well. The ridge at the top of the slope was just beyond rifle range. There are two or three figures near that wagon. The Apaches must be waiting just beyond the ridge where they can't be seen. That's right, sir. But the attack should start most anytime now. Yes, sir, no. See, look, the wagon is moving down the slope toward our gates. They're pushing it. Colonel, that's an army wagon. It's some trick. Look, the Indians have appeared all along the top of the slope. They're waiting there. It struck. It just struck me that the wagon may carry a gunpowder. And it would know how to attach a fuse to make it explode at the gates. What do you mean, back quickly? Right, sir. Pretend I get the man back from the gate. The thunder had lashed the front axle of the wagon with raw hide so that it wouldn't turn but would roll in a straight line. A heavy vehicle moved slowly at first. Then Gavipo met him as it rolled down the slope toward the gates. A sputtering fuse which Pender had measured for exact timing hung over the dashboard. Pender and the Apaches watched in tense silence. But another had been watching, too, from a grove off to the right and parked way down the slope. The lone ranger saw the rolling wagon and realized its purpose. Easy city, big fella. Come on, sir. The great white stallion sprang forward at a gallop and raced to intercept the wagon. Faster, big fella. Faster. Come on, sir. The lone ranger followed the course parallel to the ridge and half way between the ridge and the stockade. The Apaches saw the racing steed and realizing his intention opened fire. He climbed close to the mass plan. But the great speed with which Silver was moving made him a poor target. Hurry, silly. Come on, silly. The magnificent white stallion heated the urgency in his master's voice and exerted every ounce of strength of his command to increase his speed. At the stockade, the Colonel and the Captain had also seen the masked man galloping toward the rolling wagon. He's trying to reach the wagon before he gets to the gate. The Indians are trying to stop him with gunfire. Is that close enough for a good shot? Have them in fire toward them to keep them back. Aye, sir. Open fire. Hold the Indians back. He's getting close to the wagon. I hope the heavenly makes it. Let's hope he doesn't get a bullet before he can reach it. The wagon had gained momentum and rolled heavily down the slope. Faster, silly. Faster. The wagon was still several hundred yards from the stockade gates when the lone ranger reached it and he turned Silver so the horse was running alongside. Gating the distance, the lone ranger with a mighty effort seemed to hurt himself from the saddle onto the wagon. He quickly cut the fuse, then turned and grasped the lever that applied the wagon brakes. The wagon slowly break to a stop a few yards from the big gates. Open the gates. Absolutely. There's gunpowder in that wagon, Colonel. Better have your man rolled inside. Reaching the way. Hatches and raids because the lone ranger had ruined their plan to blow open the gates. Warmed down the slope in reckless abandon. Here they come! They pushed into the stockade and the gates were closed. The gate forced the Apache's back at first. Then they started circling the stockade shooting flaming arrows and firing their guns constantly for a short time in spite of many casualties on both sides. The battle continued without abatement but the superior numbers of Apaches began to fail. What's to the concern of the Colonel? We've been able to hold out this long because of that gunpowder we took from the wagon. But if this keeps up, we're bent for it. Don't give up, Colonel. We're not beaten yet. You're the inspiration to be introduced. At least, quite of all, we can do it. Itchy? Look, coming over the ridge. The reinforcements. The sight of the newly arrived troopers galloping down the ridge brought relief to those within the stockade. For a short time, the Apaches withstood the onslaught. But when Chief Big Crow fell wounded and Pender was shot from his saddle, they were leaderless. The braves that were left tried to get away but were soon subdued by the troopers. The battle ended as suddenly as it had begun. Tutto and the Lone Ranger stayed to help with the casualties. A few hours later, they were mounted on Silver and Scout near the stockade gates. May frame say, I can't find words to thank you enough for all you've done. Thanks for our necessary, Colonel. We're glad we were here to help.  Well, thanks, Captain. My only thought was to prevent the explosion. I didn't think of the risk. We have proof that Pender was behind the whole thing. He's badly wounded, but if he recovers, he'll face the charge of treason. Major Norton's men will take the Apaches to a reservation. Then our work here is done, Colonel. Follow while I'll stop to see you when we come this way again. Adios, adios, adios! Who are lives to those two, Captain? Yes, I know, sir.  Captain, he's a man among men, ready at all times to fight for God and for his country. He's the lone ranger. Get on your way. The fact that champions are made, not born, is a wonderful inspiration to all of us. Here's how it happened in the case of Red Shane Deans, star-second-sacre of the St. Louis Cardinals. When he was bat-boy for a team to be a champ with young Red's dream, he learned to feel to hit the slide. And here's a tip to be your guide. Wheaties helped him hit his stride. Now Red makes that double play. Wheaties keep him on his way. Sure, Red Shane Deans has been powering up on Wheaties for 20 years since he was 11 years old. Good food, Wheaties. There's a whole kernel of wheat in every Wheaties' flake. Let's go, Red, hit a double! On his way, on his way He's on his way, on his way Get on your way With Wheaties Cross-champions are made not for Yes, sir! Get on your way Get on your way Get on your way with Wheaties Breakfast of champions The copyrighted feature of the Lone Ranger Incorporated is created by George W. Trendle Produced by Trendle Campbell Muir Incorporated Directed by Charles D. Livingston and edited by Fran Stryker The part of the Lone Ranger is played by Brace Beamer Your announcer, Fred Foy The Lone Ranger is brought to you by General Mills every Monday, Wednesday and Friday at this same time. Be sure to listen.


Several lakes in Africa are undergoing a process of desertification. One among them is Lake Victoria. To know about this Lake Victoria, kindly watch this video. Lake Victoria is also known as Victoria Nianza. It is one among the African Great Lakes. Here note that it is the Africa's biggest lake and also the largest tropical lake in the world. In terms of surface area, it is the second largest freshwater lake present in the world. Lake Victoria is also well known as the source of the longest branch of the Nile River, that is the White Nile. Now coming to the geographical location of the lake. See it lies mainly in Tanzania and Uganda, but some parts of it is also present in the country Kenya. This is all with respect to the geography of the lake. Now let's see the economical importance of this lake. The lake has more than 200 species of freshwater fishes present in it. Among these, the tilapia is the most economically important fish. Here note that the lake also acts as an inland water transport linkage for the three East African states, that is Uganda, Tanzania and Kenya. Furthermore, the lake is a major reservoir and source of water for domestic, industrial and commercial purposes in these countries. So we can understand that the lake serves as a fishing ground, water source and even for producing power through hydroelectric power plants. This is all with respect to the economical importance of the lake. Now coming to the present condition of the lake. See the lake is threatened by the consequences of overfishing. Also it is threatened by ecological damage caused from pollution and invasive species such as the Nile Perch and Water Hyacinth. Let's see briefly about the invasive species Water Hyacinth. It is a freshwater plant capable of vigorous growth in the water bodies. It was introduced in the African continent as an ornamental plant in the early 20th century and since then it has spread rampantly. In Lake Victoria, the water hyacinth caused a reduction in fish. This is through deoxygenation of water. It blocked the inland outflows of the lake thus it led to disruption in the fishing activities. It also acts as an impediment in the freer movement of transport of goods. But also note that Lake Victoria is now being affected by eutrophication. Let me explain to you briefly about the term eutrophication. See eutrophication is the process in which a water body becomes more enriched with nutrient. This leads to excessive growth of algae and plankton in a water body which leads to the blockage of sunlight into the interior parts of the lake. See eutrophication is considered to be a serious environmental concern. This is because it often results in the deterioration of water quality. Thus eutrophic waters can eventually become dead zones that are incapable of supporting life.


If you guys play my team and you're sick and tired of opening packs that you never get any players that you want from I recommend just go on a gold art comm and using the code NS for a discount to purchase mt And just buying the player that you wanted from the packs gold art is a cheap and reliable company that will give you your mt It's amazing sight man use ns for a discount and let's get on to the video All right. Yo, let's get everyone Nick Smith is back today. It's time for something big It's time for a new my GM series with the one and only Indiana Pacers It was the 10 that you guys voted for and what I plan to do is I Planned to Hopefully if all goes well, I plan to play about a season with the Pacers Indiana Pacers and then I can relocate after this season or maybe two years from now I don't know yet. I'll have to you know talk it over with you guys So you guys want to just come down below actually in this video in the comment section Comment down below. Should I relocate the Indiana Pacers after this year or should I do it two years from now? But uh, yeah, let's advance. Actually, let's look at the team roster man PG this boy this man PG is the monster you guys already know. I'm a huge fan of Paul George I'm at a mix of Paul George like two weeks ago if you guys want to go check it out It's on the channel CJ Moll this boy CJ Moll's this guy right here He is some cheese look at this man 90 shot three. Are you serious right now? 85 mid-ranges looking good as well. Montaels He might be a guy that I I looked to trade. I mean He can't really shoot all that well from downtown. He is a six foot three shooting guy He is under size now, which you know throughout his career He could kind of get away with it But since he's like how is he 29 now and he's not as quick as he used to be I mean, he's still all right. Like he's not bad, but his defense is lacking I Don't know man. He's just I mean acceleration. It's pretty good right there, but electric quickness and speed It's not it's not looking too high for our Montaels, and he's not having a great year this year either So He might be a guy that I looked to trade but we'll see what happens And then we also got miles Turner this guy miles Turner He's been a little injured this year, but I like miles Turner He's a big man six foot eleven that can shoot mid-range and a little bit of that three ball Obviously as he progresses through the NBA He might be able to do that a little bit better, but he's a big man that you know He can hit his free throws his standing dunce looking all right I saw in the first couple of games of this of this year His offensive rebounding isn't too good, but his defense is all right defense of rebounding and then the defense is It's okay block is at an 85, which is really good Like I remember the start this year this man miles Turner was blocking heaps of shots So that was kind of cool to see but let's get into it We're choosing the Indiana Pacers as our new my GM series, so that should be good, and I promised to you guys You're gonna see in this series.  I'm gonna go Phoenix Suns my GM, so I'm just gonna make it an unrealistic my GM So he's not completely unrealistic all right So for all the guys that don't want to be don't want me to get Durant LeBron Chris Paul Mello on the old on the same team I'm not gonna do that man in this year is actually kind of hard to do that My GM is kind of hard this year, but anyway It's not gonna be completely unrealistic It's just gonna be like a fun series where if I see a nice trade I'm gonna make that trade All right, I'm a straight shooter and I tell you like it is here's what I'm expecting from you this season Let me be clear. I don't respect this honesty. If you make a promise to a player, you best keep your word. Okay What did I just say? Okay, uh, I will say I might accomplish that mm I will accomplish that I will I will accomplish that Uh, morale above the 60. I might accomplish that. I don't know like If a guy if a player wants to be traded, I don't know if automatically his morale goes down I think it does. I'm just gonna say maybe I'm 28 is the maximum number of losses. I'm willing to accept Um, I guess you could say we're kind of a rebuilding team although we have a I don't know because we have Paul George and he's like a superstar like he's a really really good player He's running for MVP this year. I mean this boy Paul George is a monster. So I don't know um 28 though hmm I might accomplish that.  I don't know man Um, we need a big three. I expect you to get us one. Okay. I will accomplish that I'll try and get a big three. That's something I want to do like that's For all the guys that want to see a realistic my GM series If the owner tells me to go to get a big three that I'm gonna go get a big three Budget obviously. I can't even change that. So yeah, let's just get it started This has already gone on for like Four minutes. So uh load and download draft class if you guys want to get a draft class and you want to find the best draft class I recommend using embrace the pace his draft class is really really good Uh, I don't even know why I did that because you can't even see like I don't know man I'm pointing at the tv, but you guys can't see the tv.  Uh, it's pretty good. So I recommend you guys, uh, definitely, uh, definitely Download that one if you guys study in your my gym zoos and also if you're new to this If you're new to the channel, this is the first video that you've watched definitely hit that subscribe button I post my career with the Carmelo Anthony my career series. I post my team. That's kind of my funny videos I uh, I try and make the my team ones a little funny a little more um Enjoyable to watch the my GM ones. They're just relaxed time.  So, uh, yeah, that's pretty much the channel leave a like on the video If you guys want to see the next episode, I'm not done But if you guys want to see the next episode of this series Let's see if we can reach 600 likes for the next episode immediately. So, yeah, um, let's look at our roster I know I know kind of what the roster looks like Um, but I kind of have a plan in place and we can't have this man before y'all and starting a power forward Here's a he's a good backup. All right. I'll give you that But it's a 69 overall starting a power forward and the reason is we've got no power forwards Apart from rakeem christmas, but you know this this man rakeem christmas. I don't yeah. Is it rakeem christmas? I think it is um 65 overall, so he doesn't get any minutes on this squad. So yeah, we're gonna go after a powerful That's something that we're gonna have to look after Um throughout the next couple of episodes. I probably what I'm gonna do is I'm gonna make a trade in this episode Maybe a small trade. I don't know. Um, then in the next episode I'm gonna play a game the first game which is up against the raptors See how the players play. So I'll just see how the team runs See who I like who I don't like if I want to make anyone You know on the trade block. I'll make some trades in the next episode after that. So, yeah, um first of all Let's go to free agents any free agents. I want to look after Um look after yeah, that's that's not really what I'm trying to say any free agents that I'm looking Towards getting it's probably what I'm trying to say larry sanders I mean He's a great player in 2k. Don't get me wrong How's this defense looking? 94 block man. He hasn't lost any of his touch on 2k Ray Allen. I mean, I don't think we need a ray on imagine getting germano neil back on the Come on down below Do you want me to get germano neil back on the indiana paces for those that don't know? Maybe you weren't watching nba. I don't know Maybe you just didn't know this man germano neil. He was a monster for the paces averaging, you know 24 points eight rebounds Two blocks. I mean this guy in uh 0504 or five Pretty good player. I mean that was his best season. I think but He was a great player when he played for indiana Um, and he was actually all right when he played for miami But I I mean he had a pretty good field goal percentage in that year. Well, actually Anyway, enough of that enough of that. I probably won't even get Did I see denny granger down there as well? Imagine bringing back germano neil denny granger. I mean these guys aren't good in 2k anymore So I don't know if I really want to get them, but 80 shot three is not bad um PG used to back up denny granger and now denny granger might back up pg So comment down below if you guys want me to uh get denny granger or germano neil back It'd just be kind of nuts. I don't even know. All right, so I guess we're gonna have to go after a powerful I think let's have a look at some powerful. It's obviously ante Davis. Do you want off of me?  I would hope so, but yeah, I know he's a beast So I don't think I'd be able to get carl ante towns um This mad drama great. He's bawling in real life. He's killing it Or stefko is killing it as well play thompson's. He's he's actually started to play a little bit better compared to how they Played at the start of the year, but anyway um Hmm power forwards Who's a pal? I mean, I would have gone after tristan thompson At the start of the year, but look at his contract now five year 82 million dollars I don't know if I want that kind of a cat space Like I don't want I don't want to fill out the cat space because if you if you're going to free agency You got some really good plays this year so, um Yeah um I'm I'm I'm I'm I'm I can't a young powerful. I want a young power forward but The powerful with position is kind of weak in the mb. I just realized that man I mean, christops, that'd be kind of nice But obviously the nicks aren't gonna offer me Creek stuffle, I just did him a jiffy. I'm sued with a lake. I don't really want to get julius randall again Daddy's young.  I like Miles Turner I want to I want to keep him like he might not get many minutes this year just because of how our center position looks like If we go to our roster and we go to our center position. We got Hill and Mahimi and then we got Miles Turner. I Might have to get rid of Mahimi actually just because I want to run Miles Turner at backup center But I mean we can always just run them at the third string and then maybe next year He might get some more minutes. I mean we'll just see what happens with that So I was up to the Nets Thomas Robinson, what's his stats looking like? I mean he might be wanting a starting power forward position 84 close. That's okay. I guess 79 driving and 70 standing dunk. He's six foot ten What's his rebounding looking like pretty good rebounding for a power forward? His defense isn't looking too good, and it's what's on the 58. So I guess I'll come back to that Kenner three four year 50 million dollars I Like Kenneth like he's a 92 standing layup, which is pretty good. What's his dunk looking like 80 standing dunk 75 drive I like the manimal. I'm a pretty big fan of the manimal. I got some friends to go for the Denver Nuggets So You know I kind of always get to hear about the man who and how he's been playing But his defense is actually kind of good in 2k 80 pick and roll defense isn't bad Block is only at a 61, but he's only a six foot eight power forward. So you don't expect that Let's look at kind of read see if maybe we can get kind of read as a big play at it to our get on this team We're being offered some pretty good like I'm not gonna get rid of CJ miles But Kenneth read is only a two-star Listen, let's let's try to get care for read and This New York Knicks pick It's only one and a half. Yo, I'm gonna I'm I'm going after this boy kind of read and the pick Okay, we'll give up You know this when Paul George was injured Solomon Hill stepped it up I'm not even gonna lie, but his stats aren't they're not really very good in 2k Yeah, they're they kind of weak. I don't know. I mean I I saw him throw it down a couple times Last year, but he's only got a 39 driving done. So I don't know about Solomon Hill this year I think 2k kind of underestimated Solomon Hill, but um We lose a Yeah, we only have one power forward actually. Oh, no, we've got to we're keep Christmas. All right Let's let's Ronnie Stuckie Because he's a shooting guard that has a he's a two-year 14 million dollar contract Which is kind of heavy for a team that is looking to I guess kind of rebuild and since we have CJ miles and Monte Ellis Where is the where's Stuckie gonna fit this year? I don't know. I mean we could either get rid of Monte Ellis or CJ miles or What's the name Ronnie Stuckie sir? I Kind of like Monte, but he has a really big contract for what he will produce. I think so I guess we'll have to see what happens Mehimi and why wouldn't the trade go through the Nuggets would have too many players alright, so there is some good players I know that for the for the Denver Nuggets Gary Harris is a 85 shot 3 for Gary Harris What's his defense looking like I think he's a pretty good defender, right? It's alright 79 on ball defense is alright will Barton. I know this guy's got some crazy dunking ability It's only a 71 Damn, they they underestimate will Barton's dunks in this game But I reckon with the new update that will come out eventually He'll get some he'll get some pretty good dunks Not dunks. He'll get some pretty good Update to the dunk. That's what I'm trying to say. All right. Let's offer. Let's give them some picks as well 2017 paces 2019 paces and let's see what they say They don't want that. How about a second round pick as well and another second round pick Yeah, I didn't think they're gonna take that Maybe not Gary Harris Maybe I'll take Mike Miller just because he has a really good three-point shot as well and he's only on is your what's his contract looking like? I hope it's on a one-year. Yeah, it's only on a one-year deal What about this and I won't give up my 2017 one and I'll throw in a second round pick Another second round pick They don't like that. They don't like that. Um Hmm You know what instead of 2018 how about a crap? What do I just do? Did I just get rid of yeah, I got rid of Ronny's sucky I'll give you a 20. What if I gave you my 2016 first round pick 2016 first round pick for a 2016 first round pick. I think that's reasonable. We're giving up Three four four and a half. They're giving up three four Four and a half as well Let's see what they say What about some say surely if we give up some second round picks they'll agree to it I think I think we can get away with it. I guess not man. I guess not So we'll offer a nut we'll offer a another first round pick the 2019 one and Some second round picks as well I don't think I don't think Okay, I don't think they're gonna do this trade That those second round picks boy though those second round picks come in handy Damn, I don't think that show is gonna go through it. So Simply business that's great right there. So I will take that. That's a great first start to the series That's the first trade done We what was the end result we traded? Yamahimi Stucky and Our 2016 first round pick along with just a bunch of the second round picks that you know second round picks in the draft I don't use those picks. So it's kind of okay They're only really used for trade value and then we get Jennifer Reed a Nick's first round pick which I think will go up in value because a lot of the time in 2k the nicks always seem to do kind of bad along with the wizards I actually try and get the wizards first round big in like a couple of episodes and then we get Mike Miller Just a one-year contract can shoot the three ball can leave after this year We'll see what happens with Mike Miller, but 87 three ball. I mean, that's that's nice He can hit that three. So I'll take that and we got a we've got a starting power forward Which now we can run our la voy Allen off the bench, which is awesome That's a great start to the series So, yeah, we got our starting power forward, which is awesome we're gonna improve his mid-range throughout this year as well because His mid-range is out of 64. Hopefully we can get that up to 70 if he can shoot that mid-range That will be really good Because because we've got that we've got a pretty nice shooting team with a CJ miles at a 90 Paul George at a 90 We just have We just have three balls for days man with CJ miles and Paul George, but um, yeah in the next episode I'm gonna be playing the first game Of the season up against the Toronto Raptors. You know, we're gonna be using those throwback jerseys I mean both teams has really not have really really good throwback jerseys. So, yeah I hope you guys enjoy the video If you did please if you guys want to leave that like I appreciate all the love and support that you guys have Shown on the series. Thank you for 36,000 subscribers as well I'll definitely start to upload more of this series and I hope you guys enjoyed the video if you're new subscribe if you want to see some more leave some like On the video and I'm out Peace


We originally were going to make a movie called Cathedral, which is going to pick up from the end of two But that was a much bigger film with a much bigger budget And we didn't have the budget to do it. So we made it much smaller movie. It's actually more of a return to the kind of moody Horror film that one is, you know, it's not the big action Feature that two was so it's a little bit more of a smaller scale movie more of an intimate movie So yeah, what is going on guys? Welcome back to the channel critical overlord here So as you just saw on the screen in that clip that I just had on screen Jonathan Breck who portrays the creeper He basically gave an answer as to why the movie that was once titled Jeepers Creepers 3 Cathedral, which was actually previously titled before that Jeepers Creepers 3 the creeper walks among us. He basically just explained why the film didn't come to fruition what held it back and Why we got the third film that we actually did so Basically just stuff that everyone's kind of just already assumed from the beginning with three and just the rumblings about the budget and how Low-scaled it was and you can clearly see what some of the issues were just with the simple fact of the film that we got Jonathan Breck, he confirmed that the reason Cathedral did not happen is because as I've made mention of on this channel And for those of you who've read the script because I've shared it with quite a few people if you would like me to share with you Just leave your email down in the comment section below Cathedral is a script that has a lot of action just as much action as Jeepers Creepers 2 if not more I believe there's one there's one sequence in that script that I read that featured the creeper taking on like several members of Poho County who are armed and ready to go against this thing and There's a few law enforcement in the area. I believe that was also on board It was just a full-on onslaught against this creature and they did not get the proper budget to do Cathedral So Jeepers Creepers 3 is just as action-packed as the second one if not more Jebus Creepers 3 Cathedral the script that we didn't actually see get made into the actual third film that script Had a lot of action-packed sequences in it There's several several tragic Several tragic deaths also in the script that include deaths from several beloved characters that go out in Like very intense sequences that just could not have been They could have they couldn't have brought the script justice with such a low budget that they got for the Third film that we got in 2017 where it's set in between the first two movies So that's basically all I wanted to say on the matter Jeepers Creepers 3 Cathedral It did not happen because it was a bigger script It required a lot more attention and they didn't want to do that with such a small budget I believe also Cathedral because I haven't read it in a while Cathedral doesn't go actually into detail as to what the creeper is But it kind of just makes reference to what the settlers or early po-hole County settlers called it But there you have it that's why Cathedral did not happen What do you guys think should be done to make sure that this doesn't happen again because At the moment I want to say Victor Salva because again the the report that I got Said that they were filming in Canada I'm still trying to cross-reference everything because I'm talking to all the people that I have contact to for this for this movie And who's worked on the project. I know somebody who I don't personally know him But I have contact with someone who has contact with Victor Salva. I'm reaching out to him I'm reaching out to the gentlemen who told me that for was in the making I personally just meet with everything that's going on I think they're trying to do it quietly so they don't have this upward that three had But let me know what you guys think about that down in the comment section below that that this is why Jeepers Creepers Cathedral did not happen and with the rumblings coming out that I heard that the Budget for four is quite bigger. That's if the four fourth film is even actually being filmed because again I have no concrete evidence to actually confirm that Let me know what you think down in the comment section below if you haven't already make sure you subscribe it's in our post notifications So you never miss a video in the description. I'll have links on my social media accounts on my Facebook Twitter and Instagram You can message me there to let me know if there's any movies news or reviews You'll like me to cover in the future with all that in mind guys. I will see you in the next video


We're now going to take a look at the application where we have control volumes that are undergoing linear acceleration, rectilinear acceleration, so that's basically acceleration that is only due to translation. Okay, so we're looking at conservation of momentum due to control volumes undergoing translational acceleration, so that would be in one direction that we're looking at. And why we'd be interested in this, you can have applications whereby the control volume is not stationary, nor is it moving at constant velocity. So an example of this is a rocket, when you consider a rocket, a rocket accelerates as it's moving, it might be moving in one direction, but if you wanted to do control volume analysis on that type of system, what would you need to do and would the equations apply? Well, it turns out the equations as we currently have derived them do not apply, so we have to do a little bit of a correction, that's what we're going to be doing in this segment is coming up with a modified version of conservation of linear momentum for control volume undergoing rectilinear or translational acceleration. So if you look back, what we had was the equation for extensive property that relates a systems-based approach to the governing equations to a control volume. And so we'll be referring back to that in this lecture, in this segment. And so if you recall from the last segment or section that we looked at, cases of linear acceleration, we said that as long as you measure the velocities relative to the control volume, you're okay. So that's where we had constant velocity of the control volume. So as long as we measure the time derivatives and the velocities with respect to the control volume, we should be okay. The place where we run into trouble here is the fact that Newton's second law, so the basic law that we're dealing with actually only applies to the inertial frame of reference, the frame of reference that is not moving or not accelerating, I should say. So when we look at Newton's second law, what we see is that Newton's second law is valid only for velocities measured with respect to an inertial reference frame. And so with that, we have to do a little bit of a correction to our momentum equation. And so that's what we're going to take a look at now. And we're going to begin by writing out Newton's second law written in an inertial reference frame. And if you recall before, when we looked at control volume as moving at constant velocity, we gave that capital X, Y, Z. So Newton's second law, then we have the force and momentum I will express as p. And what I'll do, I'll bring the derivative inside of the integral and we can re-express that then as being force integrated over the mass within the system is just going to be the acceleration within the inertial reference frame and then integrate it over the mass that we're looking at. And so what we're going to do, we're going to play with this right now. And we're going to find a way to be able to re-express the acceleration in the inertial reference frame in terms of the reference frame of our control volume. And so let's go ahead and do that. Okay, so what we have, we've basically broken the acceleration vector with respect to the inertial reference frame. So that would be our fixed reference frame that is not using, we use capital X, Y, Z to express that. That would be equal to, in two parts, one part would be the acceleration of our reference frame itself, ARF plus the acceleration of the system with respect to that reference frame. So we can break it into two parts. And what we're going to do, we're going to take this and we're going to plug it into Newton's second law which is here and we're going to work with that. So let's plug that in. So that is Newton's second law re-expressed and we have an acceleration of the system with respect to the non-inertial reference frame. So the one that can be moving and accelerating and then the acceleration of the frame with respect to the inertial reference frame. So we have this equation here. What I'm going to do, I'm going to make a substitution again and I'm going to re-express this here in terms of a time derivative of the velocity and I'll pull the d by dt out of the integral. Okay, so we have that expression there. When we put this all together, what we end up with is something that looks like this. And so this is all expressed in terms of a system, so a fixed mass system. We have done nothing in terms of a control volume. So we get that. Now that looks very similar to what we had earlier when we were deriving the, when we had the basic law, f equals ma with the exception that we have this correction term here. So let's continue working with this and see what we get. And what we're going to do, we're going to look back when we did Reynolds transport analogy and we noted, if you look way back in the notes, we had the system and a control volume and it turned out that at time equals t0, the system and the control volume coincided. They were one and the same and consequently we can make a comment about the forces acting on those two. So what we can say, given that they both coincided, we can write out that the force modified with this acceleration term on the system is equal to the force on the control volume modified by the acceleration of the reference frame over the control volume. And so with that, that will enable us to rewrite the linear momentum equation, but now it is being expressed for the case of an accelerating rectilinear. So it's just going in translation control volume. Okay, so that is the equation that we end up with. And this here is conservation of linear momentum or momentum. And this is for rectilinear. So translation acceleration of the control volume. And when you look at this, when we looked at control volume, it was moving at constant velocity, we made this modification. So we said that velocities had to be with respect to the control volume that was moving. The modification that we made here for acceleration is this term and so that's a new term that we need to deal with when we do the analysis. So what we're going to be doing in the next segment, we're going to take a look at a problem involving a rocket and we're going to apply this new form of conservation of linear momentum to an accelerating control volume.