Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-09-2012, 02:29 AM   PM User | #1
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
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?
Custard7A is offline   Reply With Quote
Old 11-09-2012, 05:15 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 11-09-2012, 10:15 AM   PM User | #3
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
So I heard, but I'm on a Linux server.
Custard7A is offline   Reply With Quote
Old 11-09-2012, 08:50 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 11-09-2012, 11:31 PM   PM User | #5
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
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.
Custard7A is offline   Reply With Quote
Old 11-10-2012, 12:06 AM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 11-10-2012, 12:27 AM   PM User | #7
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
Thanks Old Pendant. It helps to understand about the way it works, at the moment it seems direct sockets are what I'll use.
Custard7A is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:29 PM.


Advertisement
Log in to turn off these ads.