Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


OpenVZ and Java
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

OpenVZ and Java

LowEndCheapoLowEndCheapo Member
edited May 2013 in Help

Some questions: I'm looking to run a Spring/J2EE webapp under either Tomcat/Glassfish. It's a fairly heavy app, with lots of libraries in use and structures loaded into memory (session). Anyway, technicalities aside, I had the following questions about the combination of OpenVZ and Java, which, from my initial impressions, I figure is not an ideal combination. That being said,

  1. Is it possible to run Java (Tomcat/Java WebApps/Glassfish) etc. under OpenVZ? What are the issues?
  2. Is it true that Java+OpenVZ require more ram than usual? What is the minimum, 1GB?
  3. Since OpenVZ oversells memory, is it possible that the JVM will not be able to pre-allocate memory like it needs to?
  4. If it does manage to allocate the memory, is it a violation of typical OpenVZ usage terms, since OpenVZ overselling relies on a probabilistic model of many users not using the advertised capacity, but the JVM will allocate and reserve?
  5. Has anyone successfully run Java Apps (non-trivial, memory/cpu intense) under OpenVZ? What was your configuration and experience like?

I can't go Xen/KVM because offers on LEB are typically for 512MB boxes - can these run mem heavy J2EE apps? I don't think so. So I'm left with OpenVZ as a choice (say one of the Iperweb 4GB boxes), but am not sure how nicely Java will play when paired with it.

Comments

    1. No issues under VSwap. We do it all the time. We host Atlassian products this way and other things. We also have customers that host Java applications.
    2. Not really. That's just Java and users not able to configure the JVM properly. 1GB requirement tends to have to do with the app. Glassfish is more heavy than say Tomcat.
    3. No. You mean the host oversells memory to a point there isn't free memory for the VPS. Find a good host.
    4. No. again. You are allowed to use the memory allocated. Has nothing to do with OpenVZ but how providers manage sales vs performance / expectations.
    5. YES. We have lots and lots of happy customers.

    Well the $7/4GB boxes I have no idea, but the more "normal" ones I've used as well from others have been fine.

  • Nick_ANick_A Member, Top Host, Host Rep

    As far as I know, Java issues in OpenVZ have been pretty much eliminated with VSwap.

  • rds100rds100 Member

    You may see another issues on OpenVZ, related to sockets. If java detects that the machine is ipv6 capable, it tries to use ipv6 sockets, even for ipv4 connections. However if ipv6 is not configured (i.e. no ipv6 address added, no ipv6 default route, etc.) even ipv4 connections will fail. If this is the case - ask the host to add an ipv6 address for you and suddenly ipv4 connections will work too.

  • @rds100 said:
    You may see another issues on OpenVZ, related to sockets. If java detects that the machine is ipv6 capable, it tries to use ipv6 sockets, even for ipv4 connections. However if ipv6 is not configured (i.e. no ipv6 address added, no ipv6 default route, etc.) even ipv4 connections will fail. If this is the case - ask the host to add an ipv6 address for you and suddenly ipv4 connections will work too.

    Djava.net.preferIPv4Stack=true solves it if ipv6 isn't available or just don't want to use it.

  • rds100rds100 Member

    @concerto49 said:
    Djava.net.preferIPv4Stack=true solves it if ipv6 isn't available or just don't want to use it.

    Actually no, even this doesn't help some times :( I.e. when the OpenVZ host is ipv6 capable, but the VPS doesn't have an ipv6 address. Java tries to use AF_INET6 socket, detects there is no ipv6 default route and the result is "can't connect", if it tries to reach out somewhere on the internet.

  • RaymiiRaymii Member

    The only Java app I run on OpenVZ are the Atlassian products, mostly COnfluence and Jira. Have 2 with about 2000 users against AD LDAP, running on OpenVZ, both have a seperate container with 4 GB RAM, 4 cores and 20GB HDD. The host has SSD's tough, so it is fast. And NGINX runs as a reverse proxy to handle the SSL part. No issues so far, load avg is never above 2, mostly around 1.5.

  • gnelgnel Member

    I have an OpenVZ 512MB ram vps with prometeus.net and it generates my jasper reports (from a php app by the way) without any problem, it uses vSwap as already mentioned.

  • ComfortVPSComfortVPS Member
    edited June 2013

    I think the performance of 1GB xen will better than 2GB ram OpenVZ for java

  • i am presently testing a simple application on Jboss AS 7.0 and is on openvz no issues till now.

  • @ComfortVPS said:
    I think the performance of 1GB xen will better than 2GB ram OpenVZ for java

    No. It all depends on the host - the hardware and how it's divided.

  • PcJamesyPcJamesy Member
    edited June 2013

    i run a java app on a 5GB vps with OpenVZ, i had issues with it allocating 4GB at startup. I lowered the usage to 3.5 GB (70% total)and i've never had an issue. just my experience though.

  • perennateperennate Member, Host Rep
    edited June 2013

    I'm running a Java server program (the program is relatively lightweight in terms of memory) on OpenVZ with 512 MB memory / 512 MB swap and it runs fine. Also seems to work on vServer 512 MB.

  • Most of our big nodes have been virtualized with OpenVZ to run Minecraft servers. No problem as long as the memory is available on the host node.

Sign In or Register to comment.