• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Identifying machine specs to run several java programs simultaneously

 
Rancher
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a several java programs which I run on a PC - windows 7
The programs run on Dukascopy's JForex platform

At predetermined times a day - all 'do their thing' simultaneously

Often the CPU usages says 100% and often my machine seizes up and all programs are stopped
I get OutOfMemory errors etc.

I then need to reboot and start each of the programs again

Each program conducts data mining using weka and performs many calculations

My Question:-

How does one decide roughly what specs the machine should have to accommodate what I am trying to do ?

Thank you

Bob M


 
Saloon Keeper
Posts: 28765
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you could start by measuring how much CPU/disk/memory each program consumes and adding the figures together. Add 10% to allow for multi-task dispatcher overhead. Although that won't take into consideration any resource deadlocks you might have.

You might also want to try staggering the "do thing" schedules to more evenly balance workloads.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:You might also want to try staggering the "do thing" schedules to more evenly balance workloads.


That would be my advice too.

ANY machine is going to have problems doing tons of high-powered work at once.

My other piece of advice: Change to Linux. Or, if you can't do that, run your stuff in something like a VirtualBox "machine" set up to run Linux.

Why? Because Unix/Linux is, and always has been, far better at multitasking than Windows because it was designed from the ground up with that in mind.
Windows was, and is, an "OS for dummies", and multitasking takes second place to that primary requirement, despite many tweaks to try and make it better.

Winston
 
Tim Holloway
Saloon Keeper
Posts: 28765
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to have to disagree with Winston on the Windows versus Linux question.

It's true that Windows 3.x, Windows 95, and Windows ME were not good multi-taskers, since they were built on top of DOS. But Windows NT and its descendents (Win2K, XP, 7-10) were built from scratch on top of concepts lifted from the DEC VAX, which was itself a multi-tasking platform and the only DOS in them is running in VMs within the system.

That isn't to guarantee 100% that Windows can multi-task in all situations as smoothly as Linux. Linux isn't just multi-tasking, it's multi-user and it wasn't able to assume that only one user would be working with its GUI or network logins at a time. But I've never seen any serious penalty other than that.

Having defended Windows, though, I should mention that the machine I'm using right now is running Fedora Linux, the servers here are all Linux, and I don't expect to boot up a copy of Windows until early April, and then only because TurboTax is one of the few programs with no good Linux equivalent. Intuit is tied closer to Windows than Windows itself is.

I run Linux because it's powerful, comes with an immense collection of pre-bundled tools, I don't have to pay fees every time I turn around or live in dread of software audits, I don't have to worry about my machinery talking about me to third parties behind my back, and - most importantly of all - I don't have to apply urgent security patches every 15 minutes.
 
Bob Matthews
Rancher
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim and Winston

Tim: the nature of the beast is that I need all programs to do their thing at the same time

As for Linux - well, I am 69 yoa and do find it hard to understand all that is going on in my PC at the moment - the thought of changing to Linux scares me

I would sooner try to learn more about memory leaks in Java and how to program Java better

Many thanks for your replies

Bob M
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are not able to measure resource consumption of individual programs on your system, you can try installing your programs in a Windows EC2 cloud instance that has more resources than your system - a 4 CPU 16 GB m4.xlarge instance is usually more powerful than the average desktop or laptop - and measuring them there.

Of course, EC2 may not be the only provider of Windows VMs. The concept can be used with any provider who does.
 
Tim Holloway
Saloon Keeper
Posts: 28765
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Age is a frame of mind. You don't have that many years on me and I was already dinosaur food by IT hiring standards when I first got into Linux. These days, aside from its popularity in many enterprise shops, there's also the fact that the Mac OS, like Linux, is Unix-based.

Windows stole quite a lot from Unix, including stdin/stdout and a LOT of its network utilities. Also, it's easy to play around with Linux. Although its command-line legacy intimidates a lot of people, you can burn a liveCD copy of Ubuntu or Fedora, boot it up and play with Linux at a strictly GUI level without even touching your hard drive.

Now if you want a REAL challenge, consider your options on getting all those tasks to run performantly.

You can:

A) Tune the apps and their relationships so they won't set fire to your current system
B) Buy a bigger machine
C) Buy several machines and distribute the workload between them. Say, by setting up a Beowulf cluster.

Incidentally, the "Write Once/Run Anywhere" claims about Java are true. 98% of everything you need to know to run Java apps and servers on Linux is the same way it works on Windows. A lot of the rest can be mitigated by using universal file paths (forward-slashes rather than the DOS/Windows-only backslashes). And, of course, not hard-coding paths into program logic.

For a number of years, in fact, my desktop machine was a Windows XP system, but the production servers ran Solaris Unix.
 
Ranch Hand
Posts: 165
12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bob Matthews wrote:Hi
Often the CPU usages says 100% and often my machine seizes up and all programs are stopped
I get OutOfMemory errors etc.


I would start by trying to understand what the root cause is.
When you say you get "Out Of Memory errors etc" what are the other errors and importantly which error happens first? It is often the case that one single issue can result in multiple follow on issues and solving the first one makes the others go away.
Can you determine which problem happens first? Is it 100% CPU? Or Out Of memory? Which process runs out of memory? Always the same process? Or does another error occur first?
You say 'often' - so does that mean sometimes everything works fine? Why could that be? What is different about when everything works. Think like a detective.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bob Matthews wrote:Tim: the nature of the beast is that I need all programs to do their thing at the same time


Any particular reason why?

You appear to have a pile of constraints (large volumes, heavy-duty processing, and concurrent start-up) that, collectively, are going to cause ANY system a problem.
It might be mitigated somewhat by a multi-core processor (eg, an I7), but whatever solution you come up with is unlikely to be very scaleable, particularly if those demands are likely to increase (as systems tend to do).

I believe that others have already suggested getting a second box, and I think that would probably be my approach. For one thing, you normally get more processing "bang for your buck" with a tower than with a laptop, and you could put Windows Server 2012 on it, which would at least keep you in the same "family", and you could then make your laptop part of its workgroup and farm out jobs like this to it.

The advantage of a local server (as opposed to a "cloud" one like S3, as suggested by Karthik) is that communication speeds are likely to be MUCH quicker. Most modern boxes come with gigabit ethernet (≈80Mbytes/sec) as standard, whereas communication with a cloud server is going to be constrained by your "connection speed" (probably less than 10 if you're on a standard home line). Microsoft workgroups also used to run on their own proprietary network protocol, which is much "lighter" than TCP/IP - meaning higher throughput speeds - but I don't know if it's still the case.

However, simply having a box that runs Windows Server is going to give you a platform that is much better for running stuff like this than a standard laptop; and if you get it from a reputable dealer or manufacturer you can probably have it pre-installed for little or no extra cost.

Two tips for you, which you will need to ask for specifically:
1. Make sure you get copies of ALL the installation media.
2. Ask the vendor to unlock the SecureBoot feature if it is a UEFI one (standard on most new systems) - and don't buy it if they won't do that for you. You may also need to ask them for the keystroke combination to get to the "unrestricted" BIOS menu. Each manufacturer has their own, and some are VERY arcane. No more F2/F12 that lets you do anything you like.

UEFI is a new BIOS standard that, in theory, is supposed to make them less "crackable", but in practise is used by Micrsosoft to make sure that you can't change the operating system - ie, you can't run anything but Windows on "their" machine - without a LOT of faffing around.

As for Linux - well, I am 69 yoa and do find it hard to understand all that is going on in my PC at the moment - the thought of changing to Linux scares me


I quite understand. I'm 58 myself, and currently going through the same thing with EC2, which I've been asked to set up by a friend to help support his website. I was a systems administrator for 10 years, but all this "cloud" stuff does my head in.

But just to let you know - I've been running Linux Mint (an Ubuntu variant) - for about 5 years now, ever since Vista died on me, and I've never looked back. The desktop is very "XT-like", and I can count the number of times I've had to go to the command line on the fingers of one hand. I've now installed it on literally dozens of machines - old and new - and it's actually easier to install than Windows. I've only ever had problems with one installation - a 15yo laptop with a 30Gb disk and 128Mb of memory; and I even got THAT running very nicely with a lightweight version of the desktop.

I would sooner try to learn more about memory leaks in Java and how to program Java better


Both laudable goals, but unlikely to help much in this particular case, I suspect.

HIH

Winston
 
Steffe Wilson
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

I would sooner try to learn more about memory leaks in Java and how to program Java better


Both laudable goals, but unlikely to help much in this particular case, I suspect.


Why unlikely? Out Of Memory might be indicative of memory leakage.
And with respect to learning to program better: One company I worked for hired a team of contractors to write a server application. When built its max throughput was a disappointing 40 tps (transactions per second).
Following complaints from customers my boss put a new team together to redesign and rewrite it. The new version did 4000 tps the very first time we ran it and on exactly the same hardware. Well designed code makes a big difference to performance.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steffe Wilson wrote:Why unlikely? Out Of Memory might be indicative of memory leakage.


Could be, but I'd tackle things one at a time - and the two that leapt out at me were "often the CPU usages says 100%" and "my machine seizes up and all programs are stopped".

Of course, we don't know exactly when all these things happen (or in what order).

And the fact is that OOM exceptions are (generally) pretty straightforward. CPU ones (again generally) less so.

Following complaints from customers my boss put a new team together to redesign and rewrite it. The new version did 4000 tps the very first time we ran it and on exactly the same hardware. Well designed code makes a big difference to performance.


Over badly designed code, I agree - but I have yet in my programming career to come across a reasonably written Java program whose performance could be improved by 10,000% simply by changing code.

So, I suspect there's a bit more to your story - which I'd be happy to hear.

Winston
 
Steffe Wilson
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The example I gave is absolutely real. It wasn't just a few code changes though, it was a full scale re-architect, re-design and re-write. Some man-years of effort. This was a big application.

We could have gone out and bought more boxes instead, but to achieve a 100x improvement we would have had to ask our customer to pay for 99 more servers... rather you than me Winston!

Yes, you are absolutely right to assume that the original architecture & design were unsatisfactory, but that's my point really. In the OP's case we cannot say it is unlikely to be the code because we haven't seen it and furthermore the OP has stated that he would like to improve his programming which suggests that he has his own misgivings.

Bottom line is that personally I would do some root cause analysis before spending $$$ on new boxes.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steffe Wilson wrote:We could have gone out and bought more boxes instead, but to achieve a 100x improvement we would have had to ask our customer to pay for 99 more servers... rather you than me Winston!


So instead you invest - by your own admission - man-years of code adjustments. Would that we could all do that and call it a success.

Yes, you are absolutely right to assume that the original architecture & design were unsatisfactory, but that's my point really. In the OP's case we cannot say it is unlikely to be the code because we haven't seen it and furthermore the OP has stated that he would like to improve his programming which suggests that he has his own misgivings.


Now there I'll go along with you; and - as I hope you know - I have NO problem with anyone increasing their knowledge. I wonder though, if Bob's machine is "crashing", whether he has the time to deal with the sort of niceties we're talking about.

@Bob: I think, you (and I) suspect that your machine is simply not capable of running what you want; but putting it on a "bigger" machine may only delay the inevitable, since we simply don't know WHY. You need to understand THAT before you can proceed any further. Here are a few practical ideas:
1. Get a Java process/memory profiler, and run it on your "jobs" for a while.
2. Get the latest version of Java (you didn't say which one you're running on).
3. Your question was about specs, but you haven't supplied us the ones for the machine you're currently running on.
4. Show us the Java code you think might be at fault and explain why.

Winston
 
Steffe Wilson
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Steffe Wilson wrote:We could have gone out and bought more boxes instead, but to achieve a 100x improvement we would have had to ask our customer to pay for 99 more servers... rather you than me Winston!


So instead you invest - by your own admission - man-years of code adjustments. Would that we could all do that and call it a success.


Yes of course, if one is able to turn around a customer's initial disappointment to subsequent delight and not only that but receive multiple high-value follow-on orders then that is indeed a great a measure of success for any business.
 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steffe Wilson wrote:One company I worked for hired a team of contractors to write a server application.



I think I've spotted the flaw in the planning there...
 
Steffe Wilson
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave Tolls wrote:

Steffe Wilson wrote:One company I worked for hired a team of contractors to write a server application.



I think I've spotted the flaw in the planning there...


yep, your probly right!
 
reply
    Bookmark Topic Watch Topic
  • New Topic