[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

How many objects at once is too many? (I know, it DEPENDS!)

Dear Experts,

I have an existing class that was designed to hold in memory basic information about a few HUNDRED customers at the same time.  Now the business people would like to increase that to--possibly--a few HUNDRED THOUSAND customers at the same time.  My first thought was I had to rewrite, but I thought I'd ask here first.  

I'm storing each customer in a data bean, and storing all the data beans at once in a HashSet.  There are about a dozen fields in the data bean--a few int's, a few String's, and a few long's.  I'm afraid I have no idea how much actual memory such a bean takes up.  And whatever it is, it would be multiplied a few hundred thousand times.

I know the answer is "It DEPENDS", but is that way too much memory to grab at once?  Conversely, is it definitely NOT too much?  (Have you done something similar in the real world?) Ballpark answers would be greatly appreciated...

Thanks,
BrianMc1958
0
BrianMc1958
Asked:
BrianMc1958
  • 4
  • 3
1 Solution
 
objectsCommented:
0
 
BrianMc1958Author Commented:
OK. Read that.

For the data alone I'm storing in the bean then, probably about 100 bytes.  (The Strings are all short.) Then there are about a dozen standard getters and setters.  There are simple hashCode, clone and equals overrides, and  whatever "space overhead" any Object might have.

Would anyone like to take a guess at the total-bytes-per-bean?  200 bytes?  1,000 bytes?

Thanks...
0
 
objectsCommented:
~ 150 bytes would be a good enough estimate
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
BrianMc1958Author Commented:
OK.  Can I have 500,000 of those at once in memory, for a total of 75,000,000 bytes?  Ordinary PC's now come with ten times that amount of memory.  My application will be running in the real world on servers that should have somewhere between 2 and 8 gig, and of course will have other applications running on them at the same time.

I'm guessing that if such a system can't spare 75 meg, it's got very serious problems anyway.

What do you think?  Can I do it?

--BrianMc1958
0
 
objectsCommented:
thats fine, if you need more memory you can specify it on the command line when u start up the app using -Xmx option

0
 
BrianMc1958Author Commented:
Thanks!

--BrianMc1958
0
 
objectsCommented:
no worries :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now