Howdy, Stranger!

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


Question about Xen
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.

Question about Xen

deadbeefdeadbeef Member
edited January 2016 in Help

Hey guys (...and girls),

I want to create many many small VMs (say 128MB, 1 core). I'm thinking of grabbing a Hetzner E3 and installing XenServer. I did some research but I thought I'd ask before pressing the button.

  • Will I be able to create many small VMs with Xen that they will all share the CPU? I mean, I won't have to specify a % of cpu per VM, but it will allow me to just launch a ton of VMs and it will figure the CPU usage on its own, right?
  • Will I be able to set the VMs to use the host's IP without any hair-pulling?
  • Will I be able to do all that via the command-line remotely (i.e. Xen has a cli tool that I will install locally and will execute commands on the server)
  • (optional) Is it possible to let the VMs use as much RAM as they want without a hard limit?

Thank you!

Comments

  • Awmusic12635Awmusic12635 Member, Host Rep

    If the VMs are that small, have you considered just using OpenVZ (assuming each having their own kernel is not a requirement).

    It would be a good bit more efficient.

    Thanked by 1deadbeef
  • deadbeefdeadbeef Member
    edited January 2016

    @Awmusic12635 said:

    OpenVZ (assuming each having their own kernel is not a requirement).

    It is indeed :)

  • Yes to all except the ram. You have to set the ram I believe.

    As for using the hosts IP, do you mean using the same public IP? Like bridged?

    As for the CLI, you can set up ssh or view console using xencenter.

    Thanked by 1deadbeef
  • deadbeefdeadbeef Member
    edited January 2016

    @Jonchun said:
    Yes to all except the ram. You have to set the ram I believe.

    I can live with that, good to know beforehand though!

    As for using the hosts IP, do you mean using the same public IP? Like bridged?

    Yes, same public IP - bad wording from me, sorry. I just need the VMs to have Internet access in the simplest way.

    As for the CLI, you can set up ssh or view console using xencenter.

    Thanks @Jonchun !

  • deadbeef said: Will I be able to set the VMs to use the host's IP without any hair-pulling?

    IIRC Xenserver does not come with automatic NAT, so you need one instance with pfsense/vyatta/ddwrt/openwrt/linux/whatever to do the routing. Might be able to use iptables if you don#t use bridged networking, but not sure if they removed this for HVM (likely).

    Thanked by 1deadbeef
  • @William said:

    Looks like I have a considerable learning curve on my journey. Thanks @William !

  • Never liked Xen much (rather use Proxmox due to Debian base) but if it works like KVM you need:

    2 IPs

    1 for host

    1 for KVM as router

    Configure bridge0 for external eth0 and the router KVM

    Configure bridge1 on the router KVM and on each other KVM

    Configure NAT with the IP on eth0 of the router KVM (bridge0) towards a /24 (or whatever you need) RFC1918 space on eth1 (bridge1)

    Assign each other KVMs eth0 (bridge1) an IP from this RFC1918 network and use the router KVMs int IP as gateway

    Software wise you can use anything, DDWRT and OpenWRT are simple, pfsense is higher level but this is still a very basic config, Vyatta/VyOS and alike are overkill (BGP etc.). Linux with iptables works nicely as well, you can adapt most rules from one of the OpenVPN install scripts by just changing tap{?} to the physical interface names.

    For install of the router you likely need VNC so not sure about "remotely" which you seem to imply CLI with, you can run CLI install of Linux (basically telnet or SSH to a text install) with some hacks on KVM (boot/kernel args) which likely also works somehow on Xen or you can modify an ISO to include DHCP (could probably google one also fine) or a pre-defined static IP inside your int space.

    Thanked by 2deadbeef ehab
  • deadbeefdeadbeef Member
    edited January 2016

    @William said:

    I found this interesting: http://www.slideshare.net/xen_com_mgr/xpus13-pavlicek

    If I understand right, Xen is the hypervisor and you install Linux a distro on dom0 that talks to Xen via command-line tools like xl to configure/launch VMs.

    Instead, XenServer is a specialized distro for dom0 that takes care of networking and other management things (and talks to the Xen hypervisor). It also exposes a remote API.

    I need to dig more into it, but that's how I understand it so far.

  • JonchunJonchun Member
    edited January 2016

    @deadbeef

    http://discussions.citrix.com/topic/328842-vm-with-internet-access-using-nat-via-the-eth0-xenbr0/

    Solved as follows:

    Created a VLAN from XenCenter.
    Assigned 10.0.0.1/255.255.0.0
    Configured DHCPd for serving IPs on xapi0.
    Enabled NAT and Forwarding on iptables.

    Now I have working internet access from the VM.

    Thanked by 1deadbeef
  • deadbeefdeadbeef Member
    edited January 2016

    @Jonchun said:

    Fantastic, thank you!

    Thanked by 1Jonchun
  • @deadbeef said:
    Fantastic, thank you!

    Np! If you need a server to test the xenserver setup for a couple days and all that before ordering your main server, just let me know and I should be able to help out there as well.

    Thanked by 1deadbeef
  • servarica_haniservarica_hani Member, Patron Provider

    @deadbeef said:
    Hey guys (...and girls),

    I want to create many many small VMs (say 128MB, 1 core). I'm thinking of grabbing a Hetzner E3 and installing XenServer. I did some research but I thought I'd ask before pressing the button.

    • Will I be able to create many small VMs with Xen that they will all share the CPU? I mean, I won't have to specify a % of cpu per VM, but it will allow me to just launch a ton of VMs and it will figure the CPU usage on its own, right?

    short answer yes.

    Long answer : you need to pin the cpus for dom0 or it will be starved by the usage of those small vms.

    Also if the number is huge you will be hit hard on context switching overhead so in this case you may need to do a bit of fine tuning to the scheduler so that you decrease the switching and give each vm more time to do anything useful (if the vms do alot of network work it will be very hard)

    • Will I be able to set the VMs to use the host's IP without any hair-pulling?

    As other suggested it is doable by either the hacky way as @Jonchun explained or thoughthe other way as @William explained by having 1 vm on the server and run router software on it and use it as gateway for other vms ( i would go with router vm as the other way is hackey and all you have done could be overwritten when you install any xenserver update as they assume no one change the default behavior of the hypervisor)

    Note: if you go by router VM make sure you will need also to pin its cpus or you will face issues

    • Will I be able to do all that via the command-line remotely (i.e. Xen has a cli tool that I will install locally and will execute commands on the server)

    Even better , if you go by xenserver (not just xen ) you can use xencenter to manage the server which is a standalone application that let you many stuff without the need of writing any command

    and for the command line xenserver use xe toolstack which ispowerfull when you get used to it

    • (optional) Is it possible to let the VMs use as much RAM as they want without a hard limit?

    you can set the vm to use soft limits for rm and give each high soft max limit. in this case all vms will expand freely as long as there is free ram in the system.

    The real issue will start once the ram is fully used as in this case xenserver will start decrease the ram assigned for some vms to server other vms and while it do that the performance will be severly affected.

    So in other words dont do it as it will give you almost unusable server when ram is fully used

    Thank you!

    Thanked by 1deadbeef
  • patrick7patrick7 Member, LIR

    I recommend using Xen directly, instead of using XenServer.

    Thanked by 1deadbeef
  • @patrick7 said:
    I recommend using Xen directly, instead of using XenServer.

    Any particular reasons?

  • patrick7patrick7 Member, LIR
    edited January 2016

    You can use any Linux distribution as Dom0

    Less overhead

    You know how things work

    More flexible

    Thanked by 1deadbeef
  • @Hani said:

    Ah, I understand now. Thanks for taking the time to type all this, much appreciated!

  • AnthonySmithAnthonySmith Member, Patron Provider

    use KVM, ksm will save you a lot of overhead.

    Thanked by 1deadbeef
  • @AnthonySmith said:
    use KVM, ksm will save you a lot of overhead.

    It has to be Xen for compat reasons :|

  • AnthonySmithAnthonySmith Member, Patron Provider

    I really don't understand, what possible reasons?

  • @AnthonySmith said:
    I really don't understand, what possible reasons?

    I am going to be testing various Unikernels and they mostly work with Xen. Maybe they work with KVM as well, but being bleeding-edge (read: incomplete, full of bugs software) I wouldn't like to diverge from whatever documentation there exists for them.

  • AnthonySmithAnthonySmith Member, Patron Provider

    I understand, just give them all the domU's the same CPU weight and reserve and pin 1 core to the dom0, it will be fine.

    Thanked by 1deadbeef
Sign In or Register to comment.