systemd “socket activation” vs xinetd

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I use xinetd and it works for my purposes. However I recently discovered that systemd has something built in called "socket activation".



These two seem very similar, but systemd is "official" and seems like the better choice.



However before using it, are they really the same? Are there differences I should be aware of?



For example, I want to start some dockerised services only when they are first requested - my first thought would be to use xinetd. But is socket activation better / faster / stabler / whatever?










share|improve this question























  • If both work, use what you are comfortable with.
    – RalfFriedl
    1 hour ago










  • @RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
    – lonix
    1 hour ago







  • 1




    According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
    – RalfFriedl
    54 mins ago














up vote
1
down vote

favorite












I use xinetd and it works for my purposes. However I recently discovered that systemd has something built in called "socket activation".



These two seem very similar, but systemd is "official" and seems like the better choice.



However before using it, are they really the same? Are there differences I should be aware of?



For example, I want to start some dockerised services only when they are first requested - my first thought would be to use xinetd. But is socket activation better / faster / stabler / whatever?










share|improve this question























  • If both work, use what you are comfortable with.
    – RalfFriedl
    1 hour ago










  • @RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
    – lonix
    1 hour ago







  • 1




    According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
    – RalfFriedl
    54 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I use xinetd and it works for my purposes. However I recently discovered that systemd has something built in called "socket activation".



These two seem very similar, but systemd is "official" and seems like the better choice.



However before using it, are they really the same? Are there differences I should be aware of?



For example, I want to start some dockerised services only when they are first requested - my first thought would be to use xinetd. But is socket activation better / faster / stabler / whatever?










share|improve this question















I use xinetd and it works for my purposes. However I recently discovered that systemd has something built in called "socket activation".



These two seem very similar, but systemd is "official" and seems like the better choice.



However before using it, are they really the same? Are there differences I should be aware of?



For example, I want to start some dockerised services only when they are first requested - my first thought would be to use xinetd. But is socket activation better / faster / stabler / whatever?







linux ubuntu systemd xinetd socket-activation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 58 mins ago

























asked 1 hour ago









lonix

19719




19719











  • If both work, use what you are comfortable with.
    – RalfFriedl
    1 hour ago










  • @RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
    – lonix
    1 hour ago







  • 1




    According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
    – RalfFriedl
    54 mins ago
















  • If both work, use what you are comfortable with.
    – RalfFriedl
    1 hour ago










  • @RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
    – lonix
    1 hour ago







  • 1




    According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
    – RalfFriedl
    54 mins ago















If both work, use what you are comfortable with.
– RalfFriedl
1 hour ago




If both work, use what you are comfortable with.
– RalfFriedl
1 hour ago












@RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
– lonix
1 hour ago





@RalfFriedl Good advice, but I'd rather use what is more official/standard - it seems to me that would be socket activation. However I can't find info anywhere stating whether they actually do the same thing, I don't want to run into any problems.
– lonix
1 hour ago





1




1




According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
– RalfFriedl
54 mins ago




According to the systemd crowd, systemd should be used for everything. xinetd won't cause you any problems. With systemd you have to write two files, a .service file and a .socket file. Both approaches will work.
– RalfFriedl
54 mins ago










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, and it allows services to be restarted independently.



If you have a service which supports xinetd-style activation, it can be used with socket activation: a .socket description with Accept=true will behave in the same way as xinetd. You’ll also need a .service file to describe the service. The full benefits of systemd socket activation require support in the dæmon providing the service. See the blog post on the topic.



My advice tends to be “if it isn’t broken, don’t fix it”, but if you want to convert an xinetd-based service to systemd it’s certainly feasible.






share|improve this answer



























    up vote
    2
    down vote













    You can use either xinetd or systemd for socket activation, both will work. I personally find xinetd easier to use because everything is in one file, but have also used systemd because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.



    Here as an example I used to forward TCP connection to the MySQL file socket:



    /etc/systemd/system/mysql-proxy.service



    [Unit] 
    Description=MySql Proxy Service
    Requires=mysql-proxy.socket

    [Service]
    Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
    EnvironmentFile=-/etc/sysconfig/mysql-proxy
    ExecStart=/usr/lib/systemd/systemd-socket-proxyd $MYSQL_PROXY_TARGET


    /etc/systemd/system/mysql-proxy.socket



    [Unit] 
    Description=MySql Proxy Socket

    [Socket]
    ListenStream=192.168.1.1:3306
    ListenStream=192.168.2.1:3306
    NoDelay=true
    FreeBind=true

    [Install]
    WantedBy=sockets.target


    Traditional forwarding needs Accept=true, systemd aware processes are supposed to handle multiple connections in one process or fork additional processes as required.






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470871%2fsystemd-socket-activation-vs-xinetd%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, and it allows services to be restarted independently.



      If you have a service which supports xinetd-style activation, it can be used with socket activation: a .socket description with Accept=true will behave in the same way as xinetd. You’ll also need a .service file to describe the service. The full benefits of systemd socket activation require support in the dæmon providing the service. See the blog post on the topic.



      My advice tends to be “if it isn’t broken, don’t fix it”, but if you want to convert an xinetd-based service to systemd it’s certainly feasible.






      share|improve this answer
























        up vote
        2
        down vote



        accepted










        I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, and it allows services to be restarted independently.



        If you have a service which supports xinetd-style activation, it can be used with socket activation: a .socket description with Accept=true will behave in the same way as xinetd. You’ll also need a .service file to describe the service. The full benefits of systemd socket activation require support in the dæmon providing the service. See the blog post on the topic.



        My advice tends to be “if it isn’t broken, don’t fix it”, but if you want to convert an xinetd-based service to systemd it’s certainly feasible.






        share|improve this answer






















          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, and it allows services to be restarted independently.



          If you have a service which supports xinetd-style activation, it can be used with socket activation: a .socket description with Accept=true will behave in the same way as xinetd. You’ll also need a .service file to describe the service. The full benefits of systemd socket activation require support in the dæmon providing the service. See the blog post on the topic.



          My advice tends to be “if it isn’t broken, don’t fix it”, but if you want to convert an xinetd-based service to systemd it’s certainly feasible.






          share|improve this answer












          I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, and it allows services to be restarted independently.



          If you have a service which supports xinetd-style activation, it can be used with socket activation: a .socket description with Accept=true will behave in the same way as xinetd. You’ll also need a .service file to describe the service. The full benefits of systemd socket activation require support in the dæmon providing the service. See the blog post on the topic.



          My advice tends to be “if it isn’t broken, don’t fix it”, but if you want to convert an xinetd-based service to systemd it’s certainly feasible.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 45 mins ago









          Stephen Kitt

          146k22321386




          146k22321386






















              up vote
              2
              down vote













              You can use either xinetd or systemd for socket activation, both will work. I personally find xinetd easier to use because everything is in one file, but have also used systemd because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.



              Here as an example I used to forward TCP connection to the MySQL file socket:



              /etc/systemd/system/mysql-proxy.service



              [Unit] 
              Description=MySql Proxy Service
              Requires=mysql-proxy.socket

              [Service]
              Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
              EnvironmentFile=-/etc/sysconfig/mysql-proxy
              ExecStart=/usr/lib/systemd/systemd-socket-proxyd $MYSQL_PROXY_TARGET


              /etc/systemd/system/mysql-proxy.socket



              [Unit] 
              Description=MySql Proxy Socket

              [Socket]
              ListenStream=192.168.1.1:3306
              ListenStream=192.168.2.1:3306
              NoDelay=true
              FreeBind=true

              [Install]
              WantedBy=sockets.target


              Traditional forwarding needs Accept=true, systemd aware processes are supposed to handle multiple connections in one process or fork additional processes as required.






              share|improve this answer
























                up vote
                2
                down vote













                You can use either xinetd or systemd for socket activation, both will work. I personally find xinetd easier to use because everything is in one file, but have also used systemd because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.



                Here as an example I used to forward TCP connection to the MySQL file socket:



                /etc/systemd/system/mysql-proxy.service



                [Unit] 
                Description=MySql Proxy Service
                Requires=mysql-proxy.socket

                [Service]
                Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
                EnvironmentFile=-/etc/sysconfig/mysql-proxy
                ExecStart=/usr/lib/systemd/systemd-socket-proxyd $MYSQL_PROXY_TARGET


                /etc/systemd/system/mysql-proxy.socket



                [Unit] 
                Description=MySql Proxy Socket

                [Socket]
                ListenStream=192.168.1.1:3306
                ListenStream=192.168.2.1:3306
                NoDelay=true
                FreeBind=true

                [Install]
                WantedBy=sockets.target


                Traditional forwarding needs Accept=true, systemd aware processes are supposed to handle multiple connections in one process or fork additional processes as required.






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  You can use either xinetd or systemd for socket activation, both will work. I personally find xinetd easier to use because everything is in one file, but have also used systemd because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.



                  Here as an example I used to forward TCP connection to the MySQL file socket:



                  /etc/systemd/system/mysql-proxy.service



                  [Unit] 
                  Description=MySql Proxy Service
                  Requires=mysql-proxy.socket

                  [Service]
                  Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
                  EnvironmentFile=-/etc/sysconfig/mysql-proxy
                  ExecStart=/usr/lib/systemd/systemd-socket-proxyd $MYSQL_PROXY_TARGET


                  /etc/systemd/system/mysql-proxy.socket



                  [Unit] 
                  Description=MySql Proxy Socket

                  [Socket]
                  ListenStream=192.168.1.1:3306
                  ListenStream=192.168.2.1:3306
                  NoDelay=true
                  FreeBind=true

                  [Install]
                  WantedBy=sockets.target


                  Traditional forwarding needs Accept=true, systemd aware processes are supposed to handle multiple connections in one process or fork additional processes as required.






                  share|improve this answer












                  You can use either xinetd or systemd for socket activation, both will work. I personally find xinetd easier to use because everything is in one file, but have also used systemd because it is more flexible, especially with listening on multiple addresses and socket forwarding to UNIX sockets and not just to IP sockets.



                  Here as an example I used to forward TCP connection to the MySQL file socket:



                  /etc/systemd/system/mysql-proxy.service



                  [Unit] 
                  Description=MySql Proxy Service
                  Requires=mysql-proxy.socket

                  [Service]
                  Environment=MYSQL_PROXY_TARGET=/var/run/mysql/mysql.sock
                  EnvironmentFile=-/etc/sysconfig/mysql-proxy
                  ExecStart=/usr/lib/systemd/systemd-socket-proxyd $MYSQL_PROXY_TARGET


                  /etc/systemd/system/mysql-proxy.socket



                  [Unit] 
                  Description=MySql Proxy Socket

                  [Socket]
                  ListenStream=192.168.1.1:3306
                  ListenStream=192.168.2.1:3306
                  NoDelay=true
                  FreeBind=true

                  [Install]
                  WantedBy=sockets.target


                  Traditional forwarding needs Accept=true, systemd aware processes are supposed to handle multiple connections in one process or fork additional processes as required.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 36 mins ago









                  RalfFriedl

                  3,8651624




                  3,8651624



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470871%2fsystemd-socket-activation-vs-xinetd%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      What does second last employer means? [closed]

                      One-line joke