Good morning, Mr. President, Tamir, it's a great pleasure to welcome you to Davos for the first time. Thank you for accepting my invitation when we met in Sao Paulo last April. And thank you for your valuable collaboration towards a Latin American meeting, regional meeting which will be hosted in Sao Paulo in your home city in March. Your presence here is important. As Brazil is going through a moment of tremendous and decisive transformation. As you noted, Mr. President, in a recent speech with structural reform, Brazil is overcoming an unprecedented economic crisis. It's recovering its fine fiscal balance and with it its credibility in the world and its attractivity for foreign investments. As a new, more open Brazil emerges from your reforms, Mr. President, your efforts will also show the importance of what I refer to as smart globalization. By this I mean rebuilding national social contracts while simultaneously strengthening the integration of Brazil into the global economy. Please welcome Mr. Excellency, Mr. Tamir, the President of Brazil. I wish to extend my greetings to Professor Klaus Schwab, and likewise may I extend my greetings and voice my words of welcome to all of you, ladies and gentlemen. And may I, without further ado, convey to you a clear-cut message summed up in one short sentence, i.e., Brazil is back in business. The new Brazil that is now back in business, as highlighted by Professor Schwab in his introductory remark, is a more prosperous, a more open country, a country with more opportunities for investments, more opportunities for trade and business. And all of this, dear friends and ladies and gentlemen, comes following the most severe recession we have ever faced in Brazil. And despite the recession, Brazil has nevertheless come back to the growth track. This recession, which in the past had reached double digits, came to the end of 2017 once again under control, and below 3%, 3% being close to the baseline level of 2.95 interest rates, likewise are consistently following and have reached their lowest ever level. They used to be at 14.25 and currently are way down to 7%. State-owned enterprises, which had suffered billions worth of losses, currently enjoy substantial profits. Our agricultural or crop yield has beaten all records. Our trade balance in 2017 posted a surplus of over $60 billion, also in 2017, and only until November 2017, the net inflow of direct investments in Brazil totaled $64 billion. The country risk has dropped consistently from over 500 basis points in January 2016 down to the current level of no more than 200 basis points. And all of these gains, ladies and gentlemen, were achieved within no more than one year and eight months in office. We're not talking about an administration that will last four or eight years. And in this short time span, we have succeeded in drastically changing the face of Brazil. We have as such carried out in advance the broad-ranging agenda of reforms aimed at modernizing, upgrading the economy, the business environment, the labor market, public management practices, and also enhancing the day-to-day administration of state-owned enterprises as well. Our current agenda of reforms has been recognized as being the most comprehensive series of reforms ever implemented in Brazil in a very long time. To be more precise, actually there are five key concepts in key words which very much underlie my speech today and which help capture the essence of our agenda. And they also help explain the new Brazil that has emerged as a result of these reforms, the reforms that I have referred to and will expand in greater depth. These are key terms that convey the principles and the objectives that have guided us in this historic journey we have been pursuing in Brazil. The first keyword out of the five key concepts is about responsibility. In dealing with the crisis that we inherited from day one, from the very beginning, we rejected the false populist shortcuts. After all, one ought to govern on the basis of a long-term vision. Our diagnosis was and remains unmistakable, i.e., the past populism had left us with the legacy of a fiscal, a serious fiscal crisis, and only fiscal responsibility would bring us out of that crisis. And this is precisely how we have been acting. With a keen sense of responsibility, we have, for example, afforded total transparency and accountability to public accounts, therefore revealing, without half-truths, what the country's real fiscal situation was, no pretexts, no excuses. We have thus passed an amendment to the constitution setting a new ceiling capping government spending for 20 years, a measure that, as such, ensures proper re-balancing of government accounts. As a result of our fiscal consolidation efforts, in 2017, we posted a primary fiscal deficit way below the target and way below the expectations at the time. I must also say that our sense of responsibility is not only circumscribed to the fiscal dimension, it also includes a social dimension. After all, we are talking about two sides of one and the same coin, because without fiscal responsibility, social responsibility is nothing but empty words, empty rhetoric. After all, only when public accounts are in good shape and in proper order can there be growth and jobs. Only when public accounts are in good shape can there be budgetary space for socially oriented policies that are critical in a country still marked by inequality, as is our case. The second keyword on our agenda is dialogue. In politics, as is true in life in general, very little can be achieved in isolation or alone, even less so when it comes to the task of overcoming challenges, big challenges such as those we have come across when we took office. It was absolutely necessary to join forces. The previously worn-down relations between the administration or the executive and Congress have been restored and the legislative branch, as it ought to be, in true democracies, has become a high-profile player in the collective effort to rebuild Brazil. Accomplishing our mission in office requires the ability to listen, the ability to persuade, to join forces, and to come to compromise solutions. This is how we have garnered the necessary political support for the changes we are currently promoting. The third keyword is efficiency. To that end, ladies and gentlemen, we have passed crucial reforms to improve economic productivity and boost the competitiveness of Brazilian products. An example here is our recent labor reform. We have changed our labor legislation which had been written some eight years ago and we have updated it to the 21st century. Employment arrangements that are typical of today's reality have now been given clear provisions. Employment arrangements that are already in place in so many other countries, therefore protecting workers while ensuring legal certainty to employers. I also wish to state on this efficiency chapter that we have likewise reformed our education system, particularly, and King Philip will probably appreciate this reference, particularly secondary education. We have thus replaced what used to be an obsolete model of standardized outdated curricula for a new model that is much more fully in line with the job market, a new model that now enables young students to pursue from day one their professional call or vocation from a young age. We have likewise engaged the whole of the public administration in a focused effort to enhance the business environment. We have been slashing layers of bureaucracy nationwide. Tens of red tape procedures have been either removed or streamlined altogether, all of which is obviously aimed at making it easier to import and export, to start, open up or close a business as the case may be. We are currently automating registration processes and computerizing tax and customs procedures because after all, an entrepreneur's time, we all know, is too valuable to be spent in queues or in government service counters. Our fourth keyword, ladies and gentlemen, is about rationality. Today, find in contemporary Brazil a country endowed with a legal framework that is grounded in market reality, a country that knows all too well that the state apparatus cannot and indeed should not do everything. We have adopted a realistic model of concessions and privatizations with a safe and stable regulatory framework. In the brief period of one year and a half only, just by a way of example, we have tended 70 projects to the private sector and another 75 such projects, Professor Schwab, will be put to tender in 2018. These include ports, airports, highways, railways, power transmission lines, gas and oil deposits, which are being led by Pedro Parente's efforts, offering great opportunities to domestic and international investors and companies. We have also strengthened the autonomy of our regulatory agencies, while ensuring that they will operate on a technical and independent basis. We have passed a new bill governing state-owned enterprises, one that ensures professionalism in the management of large-scale Brazilian companies. We have put in place objective rules governing the oil and gas sector, therefore releasing the state from the obligation to participate through petrol bras in all pre-salt-layer-related operations. Last but not least, we are also guided by another important concept, and it is translated through the term openness, a keyword for us. We know all too well that we live in a world where isolationists' trends are gaining ground. However, we all know that protectionism is not a solution. When we are closed within ourselves, we are closed to new technologies, we are closed to new ideas, new possibilities, and we therefore remain closed to actual, effective solutions to our shared problems. My administration has by contrast been acting to increasingly integrate Brazil to the global economy and position the country properly in the international scene. By walking together with our Mercosur partner nations, we have restored the bloc's original vocation for free market. We have identified trade barriers and we have been walking to remove them. Likewise, in the Mercosur bloc of countries, we have signed investment agreements and more recently, we have even signed an agreement on government procurement. Through a keen sense of openness, we have also drawn closer ties with the countries of the Pacific Alliance, and we have also opened up new trade negotiating fronts with countries such as Canada, South Korea, Singapore, and for the first time in 20 years, we have the realistic prospects of very soon successfully completing the bi-regional Mercosur European Union trade agreement, an agreement which we wish will prove wide-ranging and properly balanced. The Brazilian government has also applied to exceed to the OECD, an organization of which we are a key partner and whose set of standards is already broadly in line with the Brazilian legislation. At the multilateral level, Brazil has advocated a trade system anchored on rules, a rules-based system, and has also supported the role performed by the WTO in dispute settlement issues. Likewise, we have supported the Paris Agreement on climate change. Brazil was the second country to deposit its ratification instrument at the UN, therefore confirming the Paris Agreement. A country like Brazil, a country that has the largest tropical rainforest coverage on the planet, a country with one of the world's cleanest energy mixes, and a country that has succeeded in becoming an agricultural powerhouse while using less than 9 percent of its national territory, and may I stress less than 9 percent of our national territories used for agricultural production. So this is, ladies and gentlemen, the new Brazil that is in a nutshell. We are in a position to showcase to you today a Brazil of responsibility, not one of populism, a country of dialogue, not of intransigence or uncompromising stances, a country of efficiency, not red tape, a country of rationality, not of unrealism, a country of openness, not a country of isolationism. Ladies and gentlemen, I understand that many of you may be asking yourselves whether or not we will follow ahead and follow on this path into the future and whether or not this journey is not potentially threatened by the upcoming elections to be held in Brazil later this year. May I say to you, without further ado, with an absolute sense of conviction and firmness, that yes, we shall complete our agenda. The voters that will show up to cast their votes in October knows all too well that the agenda of reforms enable growth and jobs and also leads to social and economic gains. Only today, the main political and economic players all agree that there is no alternative to the agenda of reforms that we are currently promoting and putting in place. The potential for a setback in Brazil is virtually nonexistent. The next step to be taken, actually following all of the reforms, the next step will be about bringing the social security system into order, a task in which we are highly focused and remain highly committed to. The Brazilian population at large has come to the understanding that the current situation or the current system is unfair and therefore untenable, unsustainable. We will therefore battle day and night to ensure that Congress will pass the proposed social security reform bill that is currently going through Congress. Our proposed bills and reforms have actually been very solidly passed by the Brazilian Parliament. And by way of conclusion, may I say that our agenda of reforms will not be exhausted once the social security reform is completed. Actually beyond that, before the end of the year, we wish to streamline our tax system precisely in order to facilitate life for the business community, for workers, for Brazilian citizens at large. Ladies and gentlemen, may I say, as I mentioned before, that Brazil has come out of the crisis in a stronger position and has come back to the development track. And now at a point in time where the world's largest economies are resuming a growth pattern once again and all at the same time, we are in a position to provide our input and contribution. And that is why I would like to reiterate my original remarks. Brazil is back in business. And for that same reason, we wish to invite you all to take part in this new chapter in our history. Do invest in Brazil and you shall not regret. Thank you very much. Mr. President. Congratulations. We just have to imagine what it means to undertake such a package of reforms in 20 months. And you are not the CEO of a company who just, let's say, pushes the reforms through. You have to deal with Congress and with many different constituency groups. And so it's very remarkable and so five factors as a basic philosophy, it's impressive. We wish you also good luck for the last piece of the reform, which is the Social Security Reform. Now, we speak here, Mr. President, I have prepared quite a number of questions, but actually you have answered practically all of them. And maybe, Ancel Gorear, you may have more questions, but one question which I have, we speak a lot about new technologies, the force industry revolution. And Brazil, I remember in the 70s when I was the first time in Brazil, I was putting a lot of emphasis on being a leader in new technologies. And, son, you were very protectionist in this respect. How do you see the role of digitalization new technologies in the future of the new Brazil which you are building, Mr. President? Well, first of all, Professor Schwab, may I say that the topics included in my remarks were very much a foreshadow to a certain extent, these were potential questions. And the second thing I'd like to say is that we couldn't agree more when it comes to the ongoing digitalization efforts. Actually technology breakthroughs and innovations have been a central concern on our agenda. We do acknowledge, nevertheless, that we have a long way to go in that regard, but we do have a special purpose ministry in place to cover those issues, and that is the Ministry of Science, Technology and Innovation. And we have, obviously, afforded great attention to the Ministry of Science, Technology and Innovation to foster the technology agenda. And when it comes to the digital agenda likewise, and may I state for the record that very recently we launched the geostationary satellite, which has been very successfully launched. But this is a clear-cut example about our efforts to ensure that broadband availability will reach every corner of the country, you know, north, south. Even the furthest regions of the country will be duly covered by broadband connectivity. So in a nutshell, I'd like to answer your question with two key statements. Number one, our concern and interest in achieving technology innovation levels that have already been achieved by other countries. And number two, our focused efforts to likewise prove successful in the effort. Thank you again. I know now, Mr. President, that you have a number of world-class companies represented also here in the room. When we look at, you didn't mention explicitly, corruption. Now I know you have outlined policies which certainly address the issue in a fundamental way. But in the past, you still have some corruption cases which are hanging over. Do you think they may in any way influence the forthcoming elections? I believe it will prove a pretty natural topic in the discussion rounds, and as much as there will probably be a very strong debate and focused effort against corruptions in Brazil. Now the main point in your question helps me highlight that in Brazil the key institutions are working sovereignly. There's an absolute and clear cut separation among the different powers that be each branch of course operating freely and independently from each other. We also have the inspection and control agencies duly in place and operating independently and properly. One example here, Professor Schwab is the federal police service, the public prosecutor's office and the audit courts that have permanently inspected and controlled every act undertaken by the administration. Furthermore, the federal constitution does establish as one of the key anchors and tenants the absolute need for ensuring transparency and accountability in government action. So your question leads me to state that we do have institutions that are working very properly and smoothly. The judiciary has proved to try and judge very properly and smoothly while applying of course the relevant laws as appropriate. And whenever sentences are issued, sentences and penalties are served. The fact that you have highlighted should possibly have been included in my remarks because after all our efforts to tackle corruption have provided a great deal of legal certainty for anyone willing to invest in Brazil because people now know that institutions do work and operate regularly so it helps us build a legal certainty more particularly as regards contractual certainty. I'm sure you know all too well that no one is willing to enter into an investment country without really knowing what will happen into the future without predictability while or whereas by contrast when institutions are working properly as they are today contractual certainty is absolutely key and contractual certainty is the result of legal certainty more broadly and it therefore serves as an incentive to our investors. Mr. President we are coming to the end of our session and certainly we will follow up many of those issues when we meet for the World Economic Forum on Latin America in Sao Paulo's 13th and 15th of March and of course we invite you all I hope I speak also in your name we invite you all to come to Sao Paulo and maybe one last very short message Mr. President what would be we we have as a seems that we are living in a fractured world and in your country you still have also high levels of poverty what is your message to the people who presently are still left out of let's say the wealth generation process which you are reformed certainly will bring to the country what is your message to those people Professor Schwabmahn is a message of optimism to them because all of our socially oriented policies that have put in place in the course of my past year and I have in government have yielded concrete results so I do not dwell on words only but rather my remarks are grounded on the recent developments in the country on the ground one example is our keen concern about unemployment which in the past used to affect 14 million people in the past quarter one million four hundred thousand new job posts were formally established just to give you an idea ladies and gentlemen just last year when we came to the end of the year we had one million three hundred thousand job posts being lost whereas this year only 28,000 such posts were lost so a major difference between one million three hundred thousand job posts that had been eliminated when we took office down to 28,000 job posts being lost only meaning that job replenishment efforts in Brazil are proving very successful and very rapidly so and given the stock and extreme levels of poverty in certain sectors of society we have social programs such as the family stipend program for example which started in previous administrations which have now been updated and the value of which has been increased talking about the family stipend program of course we do not wish people to remain in an extreme level of poverty forever and having to benefit from government programs so with that in mind we launched a program called progressing forward moving forward meaning that with support from the business community and workers community at the large we will ensure job posts are preferentially allocated to children born to families who are current beneficiaries of the family stipend program to help them move forward and make progress ahead so we have enhanced the value of the student loan program therefore providing funds to ensure that needy students are able to likewise benefit from higher education opportunities these are all efforts that are fully underway and these are not just wars but these are concrete facts and figures that show the new Brazil before I thanks the president let me just remind you that we will go immediately we will continue with the program so please remain seated for our session on China but president tamer I think it's remarkable and it is also instilling a lot of optimism when we see what can be achieved in a short time if you have the right vision and you also have the right force or let me say the willingness and the courage to undertake such a large comprehensive package of reforms as you have done I think it's a message which will make us all optimist not only in terms of your country but in terms of what we here in the room can achieve if we work together thank you very much for coming into the snow of Davos from sunny Brazil but we will have the great pleasure to meet again in six seven weeks time thank you very much Mr.


My name is Nick Rosenthal, I'm a developer, I also maintain servers, I'm a front-end developer, so I do a bunch of things. Today I'm going to be talking actually about servers and hosting and different setups, what I call a stack. So what's a stack? You've got many dictionary definitions there, we're going to use neither one of those. So to me the stack and what we're going to use the definition as for this session is the components that make up your application. So everything from the web server software, your operating system, all the way to the code. We're going to focus primarily on the web server for this talk and some PHP processing facilities, so we're going to look into that. We're going to look at different types of setups, how they work together. A little bit of performance tuning for Apache only, not for the other versions that we're going to touch on. But I'm going to explain the differences, what each one kind of does. And then towards the end we're actually going to do performance testing on eight different setups. We're going to have a bracket format, we're going to make them fight to death to find which one is the last stack standing. So performance is not just speed, it's also speed and reliability.  Or maybe use some shared hosting and you don't have to think twice about it. But as your career progresses and you start writing more complex applications or you start actually getting more traffic, or your clients are getting more traffic, you realize that that initial setup that you were so happy with when you started to learn to code is no longer sufficient. So you start looking at different setups that you can use and improve upon. So let's look at some of those. First, if you run into this issue, maybe your first reaction is to throw more hardware at the problem. Maybe you have a VPS, it's a small little thing that's been working great forever. You get a little traffic, things start lagging, it crashes too often. What do you do? Well, you just upgrade to the next tier, right? Because that's just going to take care of it. That might fix the problem for a little while or patch the problem, but it's not scalable and it can end up costing you a ton. So this should be the last step that you take to add more resources. What you should really do is optimize your code and optimize your stack. In this case, we're going to talk about optimizing your web server. Alright, so the goals for this session. Get a general overview of the different stacks. Hopefully you'll learn something and hopefully you'll have a little fun as well along the way. I just had lunch and it's the second day of the conference, so I hope I don't bore you too much. So we'll look at some common stacks used for PHP. And like I said, then we're going to go through the little tournament style to see the last stack standing. So please, grain of salt here, big grain of salt. I'm only covering basic stuff. The tests that I'm going to run are not scientific and they're not the way you should be determining what the best stack for your project is. But I'm just hoping to give you enough information to get you excited about performance and go and study more and learn more and experiment.  Alright, so the setup for everything we're going to do today. It's a one gigabyte server running Ubuntu 14.04 long term support hosted a digital ocean. If you didn't know that setup costs about 10 bucks a month. So it's actually really economic and you'll see that you can get some really great results. So let's dive into all these different stacks that we're talking about. And the most popular by far is the LAMP stack. So who here has run a LAMP stack or runs a LAMP stack? Okay, so pretty much the entire room. So, you know, LAMP stands for Linux, Apache, MySQL and PHP. And the setup can go a long way if used properly. But what makes it so popular, it's also what makes it inadequate in many aspects. And the reason is that it's so easy to set up. On Ubuntu 14.04 and actually in previous versions as well, but the one I'm showing now, you can get a LAMP stack with one command, right? You do, as you do task cell, maybe it'll tell you that task cell is not installed. But let's get past that part. You run task cell. And next you're going to see is, hey, send me up a LAMP server. And after you do that, you're up and running, literally. You can just start hosting a site. So it makes it ridiculously easy, but you can imagine the default setup is not, you know, optimized. So according to the Apache 2.4 documentation, which is the latest version of Apache 2.4, when you install it by default, it should go into what's called the event, MPM. And we're going to get into what MPMs are. Just give it a second. But for Ubuntu 14.04, that's not correct. It'll actually install pre-fort, which is by far the most common way of running Apache. And we'll touch on all that. So anybody know what an MPM is? Awesome, because I'm about to tell you. It's a multi-processing module. What it means is pretty much how you're going to process the PHP. So, or not, sorry. It means other things. So let's say, let me tell you. So in pre-fort MPM, Apache will use multiple child processes with one thread each, and each process handle one connection at a time. So don't get hang out on all those definitions. It's just the way Apache will spawn new processes to serve service new requests. Worker MPM, which is a little more advanced and a lot less used, uses multiple child processes with many threads each, and each thread handles one connection. So less processes, but each process does a lot more. Event MPM is the latest version, and it actually just came about with 2.4. It wasn't available in the previous one. It does the same thing that Worker does, but it also adds some asynchronous processing. It's got a couple of gotchas. If you use SSL on your site, it will fall back to running just like Worker. So you lose all the asynchronous stuff. So just keep that in mind if you're interested in that. So let's dive in now that we know a little bit about these MPMs. And was that clear, or are there any questions about what each one is? Cool. All right, so let's start with the LAMP stack on Apache 2.4 pre-fort. Pre-fort, which was the default installation that we did. And if you're running 2.2, it's definitely the most popular one. And what pre-fort does, actually, it uses Apache itself to process your PHP. So you've seen mod PHP on your Apache installation. If you ever notice that that module is installed, that's what's processing the PHP. So Apache is not only serving the pages, it's also compiling the code. All right? So the main consideration to tune up a pre-fort in Apache 2.4 is the MaxRequestWorkers directive. And we're about to see it, so don't worry about remembering MaxRequestWorkers. So this is the directive that tells the number of processes that will be started to service requests. Because you should limit those if not they would go on infinitely until crashing your server. You don't want to run out of resources. So the formula for figuring out how many MaxRequestWorkers you should use, it's pretty simple. It should be the total memory available divided by the average Apache process size. So let's look at that. Can you guys see the script on there? Cool. So in this case we can see that the average process is about 2.2% of one gig. Right? Which is about 22.5 megs. We want to limit Apache to use half of the available RAM, which is about 512 megabytes. Let me know if I'm losing you with all these. This kind of tells us that we can go with about 23 MaxRequestWorkers. That is, Apache will not go past 23 processes. Just keep in mind that when I took this screenshot, the server was sitting idle. It's a server that I use only for just coming up with the test for this talk. So this has no real traffic. If you're going to monitor your site, do it over an extended period of time. Do it while there's peak traffic, when there's no peak traffic, and really get a good idea of what your average size process is. I'm telling you 22.5 megs, probably pretty low. So just keep that in mind when doing this measurement. But we know that MaxRequestWorkers is 512 megabytes. That's the RAM we want to use, divided by the process size, that gives us the number of MaxRequestWorkers. When you set it up, it looks like this. And this is one of hundreds of options you can set up for Apache. But it's the one that's going to have the most effect. So you're going to get a ton of payoff by tuning this for doing just one little five-minute exercise. So by default, it installs with MaxRequestWorkers at 150. That could potentially use 3.3 gigs of RAM, which is over three times more than we have in this server. You can imagine that will cause either swapping, which you go to disk instead of RAM, makes it a lot slower, or you can just crash your machine altogether. So limiting these numbers is really important, and you can definitely just keep Apache running happily for the server size you have. You get a bigger server, adjust the numbers again. Let's look at LimeStack Apache 2.2 free for it. So this is the same mode as the one we just saw with 2.4, but it's a little bit different to actually tune, so I wanted to show it to you. And also Apache 2.2 is probably the most popular version of Apache out there. It's not something that most people, oh, there's a new version of Apache. Let me run and install this. How exciting. Most people will ignore it altogether. So 2.2 is there to stay for a while. 1.3, which was a previous version, is probably still running many sites. So I wanted to call some attention to it. Because I wanted to keep all the machines the same and I wanted to keep running Ubuntu 14.04, I had to compile Apache and PHP from source to get it installed.  This one installed from scratch. This is what we get. You can see max clients with 150 being the default. I wanted to show you what that looks like. And instead of max request workers on Apache 2.2, it's called max clients. But they're equivalent. They do the same thing. How many processes you're going to spawn. The math we do is the same. But just keep in mind anything above the number of max clients will be queued up. So if you set it too low, you can actually make your site looks low when it's actually just sitting there with idle capacity. So don't just say, well, if I keep it down at five, it's never going to crash because it's true. But when the six requests or seventh requests or eighth requests come in, they're going to be queued up. So you want to use the maximum that does not affect your performance. So let's look at how we're going to tune that up. Average process size, which is in this case roughly 13 megabytes, which is really low. You never see this on a real working site. So always monitor your size at different stages. And even though the math indicates we should set the value to 28 max clients, I went ahead and I cut that out to 14 for this experiment. Because I know 28 is just going to kill this. I mean, I've seen it before. So we're going to keep it down to 14. And this is how we end up setting up the actual stack. You see max clients, which is the second from the bottom, is going to be at 14. All right. So let's get into some more interesting stuff. Stack with Apache 2.4 in worker mode. When you go to worker, Apache no longer processes the PHP for you. It does not compile the PHP, which makes it a lot faster. Because now it only has to do one thing, which is serve pages instead of doing actual processing of the code. So in order to use it in worker mode, you need to install the fast CGI process manager, which is PHP, FPM. So what does it do? Instead of using mod PHP, when a request comes in, it will be forwarded to PHP, FPM. This can happen both as a Unix socket or as a TCP socket, whichever one you choose really doesn't matter too much. It's mostly preference and depending on your case. FPM will process that request, send back the information for Apache to just serve it to the client. So Apache won't do any of the processing. And if you are using pre-fork, or if you don't know, you probably are using pre-fork, I strongly suggest that you look into one of the ways of using FPM. It'll make your life a lot better. All right, so here's what the info page looks like. You can see the now server API changed to FPM fast CGI. So when you install it, go check for that. It should be there. You still tune it the same way, looking at max request workers. That's the directive that really matters on Apache 2.4. And if we follow our rule of thumb math, we can see that the average process is about 8 megabytes, which is super extremely low. We keep getting lower as we move up in Apache versions. But this gives us about 64 max request workers. When we try to set it to 64, you're going to see, I don't know if it's kind of hard to read from back there, but you see warning max request workers of 64 is not an integer multiple of threads per child of 25. So in this case, what it means is you can just blindly set it to whatever number you want. It actually rounds it down to 50, because that's the closest multiple of max pair threads, or threads per child, I'm sorry. So they need to match up. So instead of letting it round down to 50, I went ahead and bumped it up to 75, just because the process was so low. So can you say that again? So the number has to be a product. In this case, when you go worker, the max request workers needs to be a multiple of threads per child. So if you wanted to put 64, you could change threads per child to 16? And that would work just fine. But you can only use so many threads per worker, so it wants them to match up properly. So you can leave the, I could have left 64 there, but it would effectively run at 50. So I went ahead and bumped it to 75. All right, last of the Apache 204 PHP FPM, we're going to look at its event, which I mentioned earlier is the newest flavor of Apache modes, and it adds a synchronous processing. This makes it a little more like Nginx, and supposedly better and more responsive. But remember, if you're using HTTPS, it'll fall back to working exactly like worker mode. So depending on the site you have, it might not even be worth to set up event, or you can set up event and leave it alone. It'll work just like worker. All right, here's the info page. Again, with server API, being FPM, fast CGI. Again, default market request for event is also 150. Let's do the math on that. And it looks like the average Apache process, actually, once we looked at it again, it was an 8 megs, I'm sorry, it was 4 megs. With maximum RAM usage with the default of 150, it would be about 600 megs, which is almost where we want it. So I went ahead and set it to 128. It defaulted to 125. So it got so close that, you know, no worries on that one. We really didn't have to come down too much from the default. All right, so we're done with Apache for now, and we go what's called the Lemp Stack. Anybody here run a Lemp Stack? All right, so we got a few. The E is actually not an E at all, it's for NGINX, which is NGINX. And it's known as Lemp because it's Linux, NGINX, MySQL, and PHP. It's another open source web server. It's claimed to fame. It's designed and written with performance in mind. So this is performed very well right at the box without having to do all that stuff we did with Apache. We will not be doing any tuning up for NGINX just so we see how it stacks up without being tuned at all. All right, just like Apache in worker or event mode, NGINX does not process the PHP. It does not have a mod PHP or anything like that. It also uses PHP, FPM. So if you decide you want to take your Apache installation to do worker or event and use FPM in the back to process the PHP, you might also decide it's a good time to try out NGINX because you're going to be doing a very similar setup. All right? And here you can see when you set that up, server software will show NGINX instead of Apache. All right, we got HHVM and Apache. So anybody here have HHVM? Cool. It's the hip hop virtual machine. Thank you, Facebook. And it's a different way of doing PHP. It does not use FPM or mod PHP. It uses HHVM. It's actually what's going to be compiling your code. It's adjusting time compiler. I'm not a computer scientist, so I'm not going to get into what JIT is, but it's supposed to make your code a lot faster. It's not a web server. Earlier versions of HHVM were allowed you to run as a web server, but not anymore. So for this example, we're going to be using Apache 2.4 with HHVM as a CGI processor, and it will work much like what we just covered with FPM and Apache. So it's got a couple gatchas. It's not 100% compatible with all existing PHP code. It's the project's stated goal to be compatible with everything, and they keep testing and adding more and more frameworks to this list, and they're really diligent about it. But it's up to you whether you want to take the plunge with this. WordPress is not listed in this page. It's one of the compatible frameworks. I don't run this in production, but in all my tests and everything, and I did a little bit of research online, I don't think there's any issues running WordPress on HHVM. But it's entirely up to you. The second gacha, and I don't think that's big, is it only runs on 64-bit operating systems. So if your server is 32-bit, no HHVM for you. All right, if you try running PHP info on an HHVM machine, this is what you get. Very minimalistic. It lets you know it's working, but it kills all those options and everything that we always like to go and look at. This is what you got. All right, another stack we're going to look at and test today is a HHVM with NGINX. So we saw Apache, Apache with FPM, Apache with HHVM. Now we're also going to be using NGINX with HHVM. Instead of using FPM in the back, it's going to use HHVM.  So, all right, last of the bunch. Lighty. Lighthttpd, aka Lighty. It's another web server. I don't use it. It has a follow-in and it is kind of was popular. I think it's worth mentioning and putting it to the test, but I don't really have much experience with it at all. As in previous examples, Lighty also runs with FPM. Anybody here ever run Lighty? So, not anymore. Well, it's there. Now you know about it. All right, so let the games begin. Anybody knows what that is? Argentina? Yeah, it is. It's the la doce. It's the bucket juniors. Anyways, let me not go there right now. So, if it wasn't clear by now, the results of these battle of the stacks don't mean much. They're just for fun and just illustration purposes. We want to see how these technologies behave with some very simple tests, minimal configuration and tuning of these servers. Some are actually running stock configuration. It's a lot of fun to run through these and it might be surprising to see what the results give us. All right, so all the stacks, like we said before, were set up in equivalent servers. It wasn't the exact same server that just kept changing all the software on, but they're equivalent. They're all on digital ocean, they go by RAM, it went to 14.04. Ten bucks a month and let's see how much power we can squeeze out of one of these. They are all running a default installation of WordPress and that's our target. So the load test goes straight into an index PHP on WordPress and gets what it gets. The rules. And you don't have to remember them all. They're going to be pretty self-evident once we get into the games, each stack gets paired against another randomly. So all the eight that we saw were actually mixed them up and let them fight each other. Each stack gets a vanilla installation of WordPress. We run all the tests using loader.io, which is a third-party service. So I'm not running them from my own network or from my own laptop. This is a third-party service that will distribute the tests and make them as even as possible. This stack with the better average response times moves to the next round. And each round's test is progressively harder than the last. That makes a lot of sense, right? The winner of the third round will be crowned last stack standing. So simple enough. First I wanted to go ahead and show you what this is a simulation of the test. So I'll let you see what it looks like when we're running it. Yeah, there you go. So there you go. You got the client's line. You got the average time. In this one, I was actually testing some static pages. So you can see I'm hitting it with about 30 to 40 requests per second, and it's staying at about 10 milliseconds. So that's kind of nice response times right there. But all the tests look like this. In the slides you're going to see, I got some short URLs with each test. You can go and actually replay all the tests that we did on this one. All right. This is how I decided the order of how they're going to fight each other. Put them in an array, shuffle it, print it out, and that was that. This is not the first time I do this presentation. So if you go back and there's actually some videos, different results each time. So we just let the randomness kind of take its course and shape what we are about to see. All right. Here's the bracket. So we're going to start with Apache 2.4 Worker against HHVM Apache, HHVM Nginx against Apache 2.4 Event. So it looks like all the heavy weight is on the top of the bracket, right? Lighty against Lamp 2.2, and then Lamp against Lamp 2.4 Prefork, which would be the default. The first test that we're running in this round is 60 clients over 60 seconds. So the server gets hit about once a second. It's pre-light load, but let's see what kind of response times we get. Who's taking the bets? I'll be glad to. All right. First one, and here are the URLs that I was telling you about. You can go to those URLs and actually look at the test and corroborate that my times are accurate and that I didn't just, you know, put whatever results I wanted to make my favorite server win or anything. So Apache 2.4 Worker with FPM versus HHVM Apache. So why not Apache is going home, for sure. All right. So HHVM Apache just shows some serious numbers against one of the most advanced Apache setups of the group. So Worker is one of the best ways you can run Apache, but obviously not compared to HHVM. So it almost had the response times in half. Again, for this situation on an idle server with 60 clients over 60 seconds, when those numbers change, anything can change. So please run the test appropriate to your stack. Okay. I want to make sure you don't run out of here saying, well, run HHVM Apache right now. It's going to be awesome because, you know, it might not be the right solution for your application. All right. HHVM NGINX against Apache 2.4 Event, the newest way of running Apache 2.4. So who's for NGINX on this one? All right. And who wants Apache event? All right. NGINX is the favorite. And yep.  That's amazing. I mean, 66 milliseconds is amazing performance, too. But 37, again, HHVM seems to really be something that you take into account and look at. It's actually not as complicated to set up as it sounds in the beginning. And warpers run pretty well on it. It might be worth considering. So in the first two rounds, two of the most advanced Apache setups are gone. And they both lost to HHVM. So HHVM advances to the next round on both occasions. And this time, it does it with NGINX. Right? In this match, we got Lighty with FPM versus the old Apache 2.2 pre-fork, which is probably the most popular setup out there. So none of us really know much about Lighty. Any bets on this one? Lighty? Anybody else Lighty? Apache? OK. Nobody wants to bet here, but let's see. Whoa. And Lighty's actually putting some decent times there. All right. Lighty wins. It shows some very promising numbers. 2.2 pre-fork is the worst test thus far by a big margin. OK? So really, if you're running this, just maybe at least upgrade to 2.4 and get a reduction of about, that was it, 60-some percent that you would do, right? So if you're still on Apache 2.2 pre-fork, get away from that. Switch it to worker mode. And use FPM. Upgrade it to 2.4. Do all of the above. It's showing its age, and it might be time to just retire it. All right. In the last match this round, we got Lemp against Apache 2.4 pre-fork. 2.4 pre-fork being the default setup that still uses ModPHP, bottom 2.4, and Lemp being the seaside means favorite, right? It's like, you always talk to a seaside and they're like, no, I'm NGNX all the way, and Lemp's the one that's been around the longest. So who's for Lemp? Close one. All right? So Lemp wins, but just the hair. And keep in mind NGNX is running with the default settings, whereas we tuned Apache a little bit, but only a little bit. And one thing I'd like to point out is what I was saying earlier is that even on pre-fork, version 2.4 performs three times better than 2.2 pre-fork. So upgrade Apache. Do just that. And you just got yourself a 60% improvement. All right. So this is what our bracket looks like now. We are going to have the battle of the HHVM. So one of those is going to go home, and they're going to make it to the final. And then we've got Lighty versus Lemp. I think there are two interesting matches there. So three out of four Apache stacks already gone. NGNX actually won both its battles. So go NGNX. And Lighty, it surprised me when I ran the test, but he made it this far and with decent numbers. So the next test for this round is 120 clients over 60 seconds. So we double up the number of clients. We're about two a second. So in this case, the performance is not linear. Some servers might perform better when they hit the sweet spot of how many connections they're accepting. And some others might actually get out of whack. So don't expect that just because it was 30 milliseconds with 60 clients, now it's going to be 60 milliseconds with 120 clients. It varies. So let's see what happens. We've got HHVM Apache versus HHVM NGNX. So they're both really fast. One of them is going to go home. He's not going to make it to the finals. So hands for Apache. So hands for NGNX. All right. And Apache wins. They're both close, but Apache moves to the next round. NGNX goes home. So surprising also. And I was rooting for NGNX, but like I said, I do the random setup. I let them fight each other. And these are the actual results. All right. And now we go Lighty, the Cinderella story. Made it this far. We're on too much madness. So we've got a dark horse there. And we've got the old seaside in your favorite, Lemp. So let's see another show of hands. And I'll stop doing this. No, I won't stop. Let's do it. So who's in for Lighty? Lemp? He's got a follow-in. Nice. So I see NGNX is kind of a favorite in the crowd, too. Very nice. And boom! Lighty takes the match. So yeah, another upset, right? Lighty's in the finals. Who knew? All right. Very close the results. They both performed super well. I think one constant you can see here is that offloading your PHP processing to outside of the web server is absolutely the best thing you can do. You know, whether it's HHVM or FPM, get it off Apache. Don't use modPHP anymore. All right. So close. But we've got a final here. HHVM Apache versus Lighty. All right. So who's going to go for Apache? Yeah. And Lighty? He's going for the underdog. He's going for the underdog. I like that, Russ. Thank you. All right. So I think we already have a good idea who's going to be fastest. But, you know, we're going to run through the test. And remember that reliability, like we said at the beginning, also plays a factor, right? We didn't look at memory usage and everything on these platforms and how much FPM is actually taken of the CPU. So at some point, you might see that one setup, even though it's faster, may not be as reliable for your kind of traffic. So always keep that in mind. So because too many errors, when you're serving pages, it won't matter how fast you can serve if you can't do it at all. So for this test, what I wanted to point out, we quadrupled the initial test. It's 480 clients over 60 seconds. That's actually getting into some hefty traffic. And let's see. All right. So HHVM Apache blows it out of the water. It's a clear winner. But Lighty made a great showing. I think this is still amazing performance with some pretty heavy traffic.  You're not going to find a ton of answers and stack overflow when something goes wrong. You know, just... But keep it in mind, you know, it's something that's out there and it works very well. HHVM Apache, I think, just shows that Apache has took the test of time, that it's progressed a lot, that its performance keeps increasing with each version, and that HHVM, you know, this new addition to our toolkit, really has some to offer. I'm not running HHVM in production at all. I got one LIMP server. I got another one that I do Apache 2.4 with Worker. Those setups are working very well for me, so I haven't had a need to move to HHVM. But this is certainly something to keep in mind and maybe experiment with. All right, so HHVM Apache, champion of the Battle of the Stacks, Workham ATL 2015 edition. But now that the games are over, I want to take a moment to tell you about a true champion. Takeru Kobayashi. You guys know who this is? You probably remember him, you just don't want to say it. Takeru became famous when he won the Nathan's Hot Dog Eating Contest in July 4, 2001, while at the same time breaking the Hot Dog Eating World Record. So until that day, the record had been 25 hot dogs in 12 minutes, which is pretty impressive. He ate 50. He didn't just stop at 26, which would have broken the record as well. He wanted to push and see how far he could go. So his honor, we're going to do a Kobayashi round. Let's take the winning stack, HHVM Apache, and let's push it until it starts breaking. And see how much performance can we get out of this $10 server when we use Apache with HHVM. So I wanted to see how many clients I could throw at it and still get zero errors over 60 seconds. The results? I hit it almost 2,500 times over 60 seconds and still got a response time of half a second. I think that's pretty impressive. If you can get this kind of performance out of 10 bucks by just changing the server, the stack you use, or tuning it up a little bit, definitely worth looking into that before you start throwing more RAM at the problem. So I played around with several tests until I found I think it's a pretty good compromise. Once I got past this point, lots of spikes, lots of errors. So this is kind of like the sweet spot for this setup, with this traffic, et cetera, et cetera. Always look at your own situation. There are other ways. There are a lot of options available that don't cost anything. So exhaust all these before upgrading server resources. All the tests were done at a server that cost $10 a month. We now know it can withstand a pretty hefty load with some minimal configuration improvements. Optimize for speed and also reliability. There's no point in serving pages really fast if the server can't deliver them at all. For someone else, it may not be the best fit for you. So always careful when you find some blog posts that promises they have the best setup. There is no best setup. It's the setup that works for your application. So look at your numbers. Use the rule of thumb math I gave you. Try different stacks and find what's the best you can get out of your existing server.  Don't be afraid, there's a lot to gain. So thank you very much. I'll take any questions if you have them. If not, we can just mull them out. Yes? Moving, reseller count and setting up something in digital ocean. I've been looking at digital ocean. I've been looking at SSL, VM, like that. Right. You know, I may have 40 sites on it, but they're not going to get that many hits. And I just went with a length back. You're going to run into putting in a lot of time to maintain your server. So if you're not looking at really, I mean, if you enjoy maintaining servers and playing around with this kind of stuff, go for it, of course. If it's something that you're just looking to solve your business problem, you have sites that you need to host and need them to perform well and not worry about, you know, how they're maintained, well, let somebody else do the work. There's some awesome WordPress-specific hosting services. There's other shared hosting services that work very well. And you will never have to worry about what Apache version you're running or, you know, if the server goes down in the middle of the night and there's the redundancy and this and that. There's somebody else taking care of that for you. However, if you want to learn server management, yeah, by all means, go to digital ocean, get a $10 server, start playing around with it. There's a ton of really cool stuff to learn. So I personally don't host my own email ever. It's the worst thing you can do to yourself. Right.  And all of a sudden, you've got 5,000 people trying to hit your site at the same time.  And you're going to have to do some learning very quickly on how you scale that server, how you have to say we were running the pre-for we were talking about, you know, the default Apache. Well, you're going to get a crash course on how to set up your max workers to work in conjunction with how much RAM you have and all that. If you're not interested in learning all that, just let the hosting company worry about it. You would still have to maintain it yourself. So when the new version of Nginx comes out, are you going to do the upgrades? Are you going to patch the operating system when there's security updates for it? So there's a lot that goes with maintaining your own server. I've got to run to the Roots talk, but I am plugging Bedrock really quick. The Roots team also has Bedrock as a stack that also finally offers HHBM. So there's just a way that you can enable. I definitely don't recommend switching between the two, but there's an ansible playbook.  Cool. You can play around with HHBM and it's traditionally a lens. Awesome. So yeah, another, you know... I'm getting off of managing a VPS right now because I had a long time ago, so not worth it. Use code Battle of the Stacks for six months for... Just kidding. Don't use the code. Yeah. About reliability, you mentioned it in the report. Have you noticed in your experience any differences between the stacks with reliability? Yes. I started learning about all these things because I tried to run, aside for a client, that was getting a lot of traffic and we were running on Apache 2.2 with ModPHP, and it just wasn't cutting it. It was, you know, just crashing and crashing and crashing and then I started looking into all the different modes, ended up with 2.4 on worker mode and actually learned to do some tuning and everything and without increasing the run, we actually, from there, we went from using 16 gigs to using four gigs and I always had idle capacity. So doing tuning really saved us a ton of money. Well, thanks everybody. This is how you get in touch with me. If you have any questions or, you know, send me an email, find me on Twitter and, you know, we can chat about some of our performance or development in general. Thanks everybody.


4D printing has emerged as a transformative technology in the field of biomedical engineering, offering the potential for dynamic, stimuli responsive structures with applications in tissue engineering, drug delivery, medical devices, and diagnostics. Materials innovations, fabrication advancements, and emerging applications such as personalized medicine, nanomedicine, and bioelectronics are necessary to overcome current challenges and realize the full potential of this technology. Collaboration between material scientists, biologists, engineers, regulators, and industry is essential for interdisciplinary research and progress in this area. This article was authored by Masiya Ramizani and Sadie Mohamed Raipan.


What is up everybody? Branding and over here with my three favorite bets for this week's Wells Fargo championship at TPC Potomac Starting off with Corey Connors to win this week at TPC Potomac We should be targeting golfers who hit fairways and greens So basically precision-based ball strikers and that is Corey Connors to a tee Connors ranks as the best ball striker in the field over the past year with my field strength and recency adjustments And there's also a 20-second in driving accuracy on the PG tour this season among this field Biggest issue for Connors will be getting up and down when he does miss these small greens But he has field average and sand saves and that's a key stat this week He should find himself in better position anyway than most of the golfers in this field off the tee with the precision And after his approach shots with the good iron play, which is why I like him to win outright We can't always and probably shouldn't always go with the big number in terms of the outright market should be opening Open to finishing position bets and Henley to top 10 is the pick here Henley rating out in my simulation model as 25% likely to finish in the top 10 this week The reason for it He's extremely accurate off the tee ranking in the 86th percentile and fairways gained over the past 50 rounds According to fantasynational.com he is second in my long-term Strokes gain Approach numbers with field strength and recency adjustments if you downplay off the tee data Look just that approach around the green and putting and they rank second in the field behind only Tyrrell Hatton over the past year With distance a bit mitigated this week I'm taking a look at Henley for a top 10 finish Finishing up here with a head-to-head Tyrrell Hatton over Abraham answer Answer is favored over Hatton in the head-to-head market and I can see why if we want driving accuracy this week Then answer wins out. However, other than that Hatton has an edge He's got better irons better wedges and better putting specifically from five to ten feet notably Hatton also really strong out of the sand that's key this week data golf shows that TPC Potomac has some of the most problematic Bunkers on VPGA tour Hatton should be able to get out of trouble more frequently than answer Giving him a higher floor this week The recent data also just prefers Hatton and so long as he can find some fairways not sprayed all over the place He should be able to outplay answer from there this week at TPC Potomac That'll do it for my favorite bets for this week's Wells Fargo championship. Let's hit a winner