- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Stupid Pratik .. you start partying once the customer is happy .. not when you think that you are done.
Admin
Admin
A system that has to do queries across 200 million rows and all the testing only bothered with 200. WTF! Very lucky that this was solvable at all, let alone without time being spent adding indexes.
Admin
Nice thought an most of us would love to do it that way but most of us have management that is far to wrapped around the 8 to 5 MTWTHF Axel to make that work.
Chances are good Patrick is not getting anytime off during the week to let loose say Wednesday after the go-live has been solid for a couple days unless he takes vacation. So what is he to do sit quietly by the phone all weekend just in case it he gets a call?
I sympathize because I have been there. If you are not getting flex-time you just can't let your job trample your own time; because you end up with no time that is really yours.
Admin
The real WTF is putting anything into production on a Friday.
Admin
Yes that really is amazing. Not totally hard to understand though. It always amazing me how many shops simply don't have a representative test environment. They will stand up shelf after shelf of fast SAS disks for a production database server, and tens of front end webservers; and insist you do all your testing on some old PC with 2 gigs a memory, one ide harddisk with a total capacity not even large enough to store the complete production database; let alone freespace and log space.
They then will get all pissy your testing was not adequate to discover certain performance and scaling issues before going to production.
Admin
Truth. Never go full retard, and never go live with new code on Friday. That's TRWTF here.
The secondary WTF is "The test DB had 200 records. The pre production db has 200 million records."
Admin
Indeed, it is policy at my place to never deploy anything large on a Friday. We even avoid Thursday if we can help it.
Admin
I stopped reading when Pratik started to celebrate before the post-launch post-mortem. Pratik, what r you doin? Pratik, stahp.
Admin
Yeah, I always insist that the test data set is at most five orders of magnitude smaller than the production data, six orders is just too much...
I have to admit I'm curious - how exactly did they 'stress' test with 200 records?
CAPTCHA: sino - sino weevil hairno weevil
Admin
And that's why I went on a week-long vacation just before our project went live. After half a year of catching up to deadlines after deadlines, it was time to say "Screw you guys, I'm going home; the rest of you will manage, I'm sure."
Admin
But apart from going on a binge before you absolutely know that the system is running smoothly under full load, there are other WTFs as well:
Admin
Clearly they didn't, which begs the next question, just how good were any of the tests?
Admin
Ditto here. sigh It will be years, if ever, before we reverse all the junk that tested great with a data set a sliver of a fraction of reality. In one success though a certain process was taking anywhere from 3 hrs to forever; we threw away all that krap kode and now it takes seconds.
Admin
The WTF is not using connection pooling. That's basic stuff for enterprise systems like this. Not using realistic DB sizes/loads in the test environment is just the icing on the cake.
Admin
Mandatory related comic: [image]
Admin
This doesn't always make sense. If your production system is important enough to end users that it be available full time M-F, promoting to production Friday afternoon is the most sensible time as it gives you the most time to solve issues that come up during production.
Granted, it sucks to be the one on tap for promotion.
Admin
Admin
No, it was PRE-production. Production was Monday.
Admin
Admin
Someone played the roll of drill instructor and shouted "Faster! Faster!" at the test team while a comically over-sized digital clock on the wall counted down in hundredths-of-a-second precision. That was plenty stressful. Adding more database records on top of that would have just been cruel.
Admin
Drinking tequila on a MMORPG is not considered as "partying" you nerd.
Admin
My guess is they were all equally "valid".
This also reminds me of the php/mysql listserver application we use at work. It's a disturbingly popular open source application that was written buy a guy who seems to think that about two hundred emails is a 'large list' and the code base is absolutely stuffed with WTFs. Things like doing ereg_replaces (yes, ereg*, not preg*) on constant values when str_replace or str_ireplace are more than sufficient and doing them on values that will never be needed. Also things like if and while blocks that run several hundred lines and dead code wrapped in if (0) tests or testing to see if a value is numeric like this:
Oh, and injection attacks galore. It would crash repeatedly on email lists larger than 10-20k. A co-worker and I have at least re-factored if not almost completely re-written every major component of the application yielding orders-of-magnitude performance increases (and security).
Admin
Wow
200 records probably allows the db to load the whole table into memory resulting in fast query response times. 200 million and disk I/O becomes a significant factor.
Why would anyone think 500 threads was OK?
Next you will tell be that the server belonged to Mitch
Admin
That really depends on the application at hand. Although 500 is a bit much, not all threads will be running all the time. They block on resources that don't respond immediately, like networks and disks. I worked on a multithreaded application that needed 30-50 threads (depending on the actual data put in) to keep 8 cores fully occupied.
captcha nulla - nulla pointer exception
Admin
Wait, why is "number of threads" a user-configurable parameter? Have the software figure out an optimal (or at least a workable) number of threads based on the circumstances, so the user doesn't just go "ooh, I'm gonna put in a big numbar so it gose fastar!"
Admin
Admin
But then some idiots turn the value up way too high. Ho hum.
Admin
TRWTF is using threads to handle IO-bound problems, but many programmers have been making that one for a long time.
Admin
Or as the saying goes: the first to run "make" get's one core, the first to run "make -j 10" gets all the cores :-)
Admin
Admin
Some people always ask "what's the right setting for this config?"
If there were one right setting, it wouldn't be a config, now would it?
Similarly, if code can arrive at the right value every time, you wouldn't need a config.
This is closely related to:
Luke: How do I do this?
Matthew: 1. Understand the tool. 2. Understand the problem. 3. Figure it out.
Luke: That sounds too much like thinking. Just give me the answer.
Matthew: Nobody gave me the answer.
Admin
Agree completely. one of our in-house memo state this, do not drink and party immediately after release.
Admin
well, since i work on a bank, friday is the only day we CAN do this.
i dont know how it works in your country, but here (brazil) banks must pay a fine for each minute off-line.
[http://www.bcb.gov.br/?spb]
can you imagine millions of clients unable to do financial transactions on a business day?
Admin
Just don't pay the employees on a Friday. Then no party.
Admin
Or that was the theoretical justification at my last job. In practice it was a management mandate that everything uses 7 threads.
(Also our "multithreading" wasn't actual multithreading and was in fact retarded, but that's a different topic.)
Admin
There is no ideal time.
If you promote friday, and the reality is production issues don't show up until monday morning because no matter how much you've tested there's always that guy who does something you really didn't expect. Well, you've lost the weekend as an opportunity to fix things without impacting users.
So instead you're into monday, and you may lose tuesday as well... Twice I observed deployments which took the Oracle database offline for a day... something about a cascading trigger storm consuming all resources. So it took two days to roll it all back.
Now imagine you work for a company that has to be available 24x7... and think about all the work that needs to go into making everything resilient.
Admin
I see this has become ::puts glasses on:: a THREAD war!
YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Admin
I think that would've been a cooler ending
Admin
If your threads are doing number-crunching, then one thread per CPU core is about the right order of magnitude. If your threads are going to spend their time waiting for I/O then one thread per I/O channel is the right order of magnitude. In this case, one thread per database connection sounds about right.
Admin
Not true at all. You're assuming all processing is done locally on those 500 threads.
Let's say you have 500 external resources that all take 10 mins to complete operation. Starting up 500 threads makes sense as you'll have all those threads waiting. Of course the alternative is asynchronous communication, but what if you're working with inputs that can't be asynchronous?
500 can't possibly be reasonable though, but I can see having more threads than cores and still getting benefit out of it.
Admin
For me the WTF is calling someone a Sunday morning for a preproduction bug.
Those can usualy wait for Monday. If the window for preproduction was only the week-end than this is the WTF : pre-production cycle take way longer than 2 days !
Admin
To which I replied. Pay me overtime.
Business should learn to stop butting into my personal life unless they at least acknowledge that they are doing so.
If the owner thinks that it's ok because he's 24/7, then maybe he should consider handing out part-ownership.
You can't expect to take up my entire life without offering anything more than a salary. At least a 24/7 daycare!!!
Admin
When we deploy updates, it's usually on friday as well. Surprisingly, we get the least number of users on saturday, and most of our customers don't open monday untill the afternoon, which means we have two days to fix problems (or simply rollback the update and try next week, if a problem is too big - our systems can generally do a rollback in minutes if need be).
Anything overlooked during the weekend is generally found on monday morning before most of our customers online, so over the past few years we've never had any serious problems due to updates. Of course, that often means working weekends, but since my hours are flexible anyway that's not really an issue for me.
Admin
It makes a difference. Apart from oddities like MUL and DIV, most instructions on an 8088 take longer to fetch from memory than they take to execute - a typical Reg->Reg arithmetic instruction will take two bytes = 2 memory cycles = 8 clocks to fetch, and three or four clocks to execute. While it is executing, the next instruction is being fetched, so an 8088's memory subsystem is active almost 100% of the time, except when some lunatic executes MUL or DIV, which are monstrously slow, and the execution subsystem normally doesn't manage more than 50% utilisation.
The 8086 can load two bytes at a time, if they are at an even address and the next higher odd address, so the balance is less uneven than on an 8088, but it is easy to get an odd program counter, at which point you are back in the 8088 situation...
Counting the strict execution clock cycles is a waste of time on these chips, as it is on anything after the 486, although for different reasons.
Admin
Admin
Seriously, if you can't be bothered to upstream improvements just fucking die. Write your own shit, from scratch, in ASM. If your project or employer won't allow for upstream patching, go with a commercial solution. You don't get to complain that you refactored if not almost completely re-written something you got for FREE.
Admin
Windows has a kernel object called an I/O Completion Port, to help limit context switching overhead. You tell it how many concurrent threads you want it to run. When threads ask the completion port for work to do (GetQueuedCompletionStatus), they block if the number of runnable threads associated with the port is already greater than the concurrency limit you specified. A thread is released if there is work queued up, and a thread associated with the port blocks. It means that the number of threads running is usually slightly greater than the concurrency limit, but not much so. It is up to you to spin up enough worker threads to handle the expected workload, though.
To queue work you either call PostQueuedCompletionStatus, or you can associate other handles with the completion port: when an asynchronous I/O completes on a handle associated with the port, that queues the result on the port (and possibly wakes a thread if the conditions are right). The threads are woken in First-In-First-Out order, to take advantage of any cache locality.
Windows' other thread pooling infrastructure is based on completion ports, as is .NET's ThreadPool class.
Threads still have some overhead - they have user-mode and kernel-mode stacks that must be maintained, so they consume quite a bit of address space. They can be swapped out, but that leads to pretty poor performance! So it's a good idea to limit it to a few tens of threads rather than hundreds. Depending on how many processor cores you have available, of course.
Admin
Admin
Adding more threads doesn't necessary == "Parallel".