 Good evening, everybody. This is Brian. I wanted to wish everybody a happy Thanksgiving. This is just kind of a Status of you know, what's Brian been doing and just kind of checking in It's Thanksgiving. So this is the season to be thankful for things my sense of humor is still pretty dark and twisted. There's big bird Also today is a hallmark drew hook away one of our administrators just welcomed our 1,000th member into the voidrums Facebook group. I'm just amazed at how this group is growing. We've got a thousand programmers in there That's just insane. This whole thing started is just me making videos for my daughter And I thought it'd be like me and maybe like two other dudes halfway across the planet talking about programming, but wow No, it's actually kind of grown so Haven't made a lot of videos because I've been really working on the C10k problem My phone's blowing up who's messaging me the C10k problem. If you don't know what it is. It's computers have come a long way, right? Back in the day When you had thousand megahertz machines with two gigs of RAM, these were like, you know, $1,200, $1,500 And they couldn't really handle a whole lot, but technology's changed computers have changed So I'm really interested in socket perk. I may always have been so when I get kind of down in a rut I get sick of all my side projects because I usually have too many projects going on I always kind of come back to this and I haven't been making videos because I've been working on this so I've showed this showed I've shown this code before it's a little structure different a little differently Forgive me. I have got turkey belly going on. I'm waiting for my stomach to just burst. I ate like an obscene amount of food today So in short, I'm trying to figure out a good project structure here, so I've got just TCP server and This is all run off the Q thread pool So you've got the server with a runnable and then the connections So the server obviously the incoming connections come into the server the runnable spins up the connections The connection is just a wrapper class that wraps the socket functions Pretty simple pretty easy to understand and then through inheritance. I just did a pretty very basic HTTP servers you get the server and the connection notice how we're not inheriting the runnable There's really no need to it just kind of works in the background so The server itself is very simple just inherits the TCP server and then overloads the isn't right overloads overrides My brain's just fried. Like I said, I ate too much food. It's been a long week Overload the accept function the accept you just have a handle which is the socket descriptor and then the runnable The connection itself is just you know the TCP connection So let's flip in here switch header and source and you see what's going on in the accept is we're just saying you know a Couple Qt bugs and then we're saying a new connection Equals, you know a new connection and then if you can't create a connection do something and then we're just gonna make connecting And what that does is that connects everything together? The super short of it is Let's run this It can run in single mode pulled mode or threaded mode I've shown this in other videos where single all connections one run on one thread It's not entirely accurate. It's one runnable that runnable represents one thread Then pulled you have a bunch of pulled connections that run in the thread pool or threaded meaning every connection gets its own unique thread It's also kind of not true every connection gets its own runnable Q thread pool does things in the background that just boggles my mind. So I'm just gonna run a test here We run it and pulled because why not? We're gonna actually say this can handle 20,000 connections Just an absurd amount of connections that will never ever really need We have an idle timeout. This is new from the last video Because sometimes when I test the sockets will get stuck in a connected state even though Siege the program I'm using the test is already closed So it's just going to idly or idly it's gonna check those sockets for idle timeout and we are now running that Let me pop open a few things here Should note to do this you have to change your your upper file limit. So if we go you limit What is it? Soft number you can see that I put 65,000 for my soft number and I think the hard number is probably also 65,000 If you don't do that, this will crap out on you around a thousand to two thousand connection I actually think it's like 1200 or something because you have what's called a file limit a soft limit So you want to definitely make sure you can increase that and a quick Google will show you how to do that I actually think it's in Cat at sea Security cash, I'm going off memory here, and I'm getting old. I've eaten a lot of food security Limits config yeah, there it is and I just at the very end of the file you just put in the The hard and soft limits and then you log out log back in and then boom you've got your limits So that's kind of where we are here Anyways, enough of that. We're gonna load up Siege The problem with the testing this is it's very difficult to actually test We're gonna do 10,000 connections in Siege and see what happens And as this thing is just churning away We're gonna go. I'm still not used to mint here I'm used to typing everything in so menus kind of mess me up Here's our system monitor. Once the metrics start loading. You'll see Q thread pool. This is why you use Q thread pool. It's balancing across multiple CPUs Your memory and swaps fine that we're handling, you know, 10,000 incoming connections Not entirely true because of the way Siege works internally and you see all right We're getting some warnings in Siege here. We're getting some alert timeouts and things like that So we're gonna go ahead and stop Siege And we had 3400 or 3048 failed connections, which is weird. You can see I have some idle sockets because there's some cleanup that Siege didn't properly handle And it's going ahead and clearing those out Not sure entirely if it's Siege because as you can see Siege has stopped or if it's the operating system It's having a problem and you can see the CPU usage and memory scaling down as there's no more connections going in there concurrency concurrency is a Approximate numbers at average. So on average we handled about 3183 connections simultaneously Across 42,000 hits. So the program is actually getting better We're not at the 10k yet And I'm not sure if it's a limitation with my software the operating system or Siege the program I'm using to test so I may have to write an entire test suite just so I see what's going on under the hood The failed transactions that's interesting to me because my program didn't have any errors There's zero error handling in here, and I didn't see any errors, but was also weapon by really fast. I did notice in testing The Siege has a hard limit boom 15,000 connections that says unable to allocate memory for 15,000 simultaneous browsers That's interesting because I have 32 gigs of RAM So there's probably some Tweaks that I need to do within the operating system because this isn't a server based operating system a desktop based etc So this is really what's been occupying a lot of my time, which is really pathetic when you think about it, but So let's just do Whoops 5,000 connections and see what happens here and Notice how I didn't stop and restart the server like you'll see some other folks do in their videos I'm just making sure all the memory handling is done correctly We can see our system resources have spun up as soon as we did this We're actually maxing out a couple of those CPUs And you'll see how it kind of balances the CPUs out That's really what Q thread pulls doing under the hood for us and our network usage spiked up as well And we're starting to get some errors here alert timeout sockets Just gonna let this churn away and churn away and churn away And let's go ahead and it looks like it's starting to die When I say it's starting to die. I'm not sure if this is Siege or something else So if you guys know of a better Web server testing tool than Siege to keep me from writing one. Yeah, I think Siege is dying Let's go and stop Siege Yeah, see this time it only handled 1900 simultaneous connections We had 1300 failed transactions So I'm really looking for at this point just a better testing suite because if I do just a thousand connections You can see it goes much smoother much better in Siege My program is just churning away and stop it zero failed transaction it handled 400 connections simultaneously So that's kind of the crux of what I've been working on. I've been getting a lot of email saying what are you doing? Why aren't you making videos? Well, that's why Went through a breakup had to move. It's been a lot of time with my kid. I think that's actually her messaging me right now Nope, it's not her. Um, she's supposed to come over in a few minutes And just hanging out with friends and live in life, but I wanted to Wish everybody happy Thanksgiving If you haven't already joined the void rooms Facebook group, I really look forward to seeing this grow It's an amazing resource. I ask questions in there all the time and people jump in and answer And sometimes people get frustrated because I ask a question and no one will answer them I Would just say if that's happening don't get frustrated just you know ask the question again Maybe worded a little different. Maybe people don't understand the problem Or they're looking at you go and have you have you heard about Google Google is an awesome resource But anyways, that's it. I'm babbling. I've got food coma going on. I'll talk to you guys later