Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Custard7A's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    286
    Thanks
    32
    Thanked 33 Times in 33 Posts

    TCP/IP and UNIX Sockets

    This seems like an age-old question, but I'm rather new to it. I found a few other articles; The general consensus seemed to be that UNIX sockets are faster because they have less overhead, or something, but I also heard that Windows 7 is faster with TCP/IP (Like, twice as fast). I'm deciding on using "127.0.0.1" or "localhost" with my MySQL connections, for what it's worth. What do you guys use?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,121
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Ummm...windows, at least, treats "localhost" and "127.0.0.1" the same.

    But MySQL on Windows may not use sockets. It can use named pipies, which are significantly faster.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder Custard7A's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    286
    Thanks
    32
    Thanked 33 Times in 33 Posts
    So I heard, but I'm on a Linux server.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,121
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    So what does it matter if Linux sockets are slower or faster then Windows? If you are on Linux, you have to use whatever Linux gives you.

    I dunno if Linux has the equivalent of named pipes. I vaguely recall that Linux has a way of using shared memory for interprocess communication. That would be hands down the fastest if it's available and can be used by MySQL.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Regular Coder Custard7A's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    286
    Thanks
    32
    Thanked 33 Times in 33 Posts
    Well, that's just it, Linux gives me two options that I know of, both TCP/IP and UNIX Sockets. I don't know which to use, or if it matters. I wouldn't know about the third option, but fastest sounds very nice.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,121
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Pure guess: TCP/IP is a protocol that is a few layers above direct socket calls. So I would *EXPECT* that the direct socket calls would be a shade faster. Mind you the TCP/IP protocol has overhead on a packet basis, so if your transfers will fit within one or a few packets I wouldn't expect the overhead to be much noticeable.

    But I haven't used Linux in about 10 years so I'm possibly way out of date and/or my memory is faulty.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    Regular Coder Custard7A's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    286
    Thanks
    32
    Thanked 33 Times in 33 Posts
    Thanks Old Pendant. It helps to understand about the way it works, at the moment it seems direct sockets are what I'll use.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •