Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to compress SQL Server network traffic?

I have a .NET client that needs to connect to a remote SQL Server over the WAN, is it possible to compress SQL traffic between the client and the server?

I am using .NET 3.5 and SQL Server 2005 and greater.

like image 747
Philip Fourie Avatar asked Mar 16 '10 11:03

Philip Fourie


People also ask

Can databases be compressed?

Database compression is a set of techniques that reorganizes database content to save on physical storage space and improve performance speeds. Compression can be achieved in two primary ways: Lossless: Original data can be fully reconstructed from the compressed data.

What is compress in SQL?

The COMPRESS function compresses the input expression data. You must invoke this function for each data section to compress. See Data Compression for more information about automatic data compression during storage at the row or page level.

Can you compress SQL database?

Compression is not available for system tables. Compression can allow more rows to be stored on a page, but does not change the maximum row size of a table or index. A table cannot be enabled for compression when the maximum row size plus the compression overhead exceeds the maximum row size of 8060 bytes.


8 Answers

Looking at the connectionstrings.com here for SQL Server 2008, the database providers do not have some kind of compression scheme...You may need to write a wrapper on a different port, that compresses the data, by using the front end, send the data across that port, from there, compress it, send it across to the remote endpoint, decompress it, and forward it on to the real tcp/ip port where the server is sitting on.

Usually SQL Server sits on port 1433...

Since a picture is worth a thousand words....

+--------+                                             +--------+
| CLIENT |                                             | SERVER |
+--------+                                             +--------+
  Port 1234                                          Port 1433 <+--+
     |                                                             |
     |                                                             |
     +={Module}=    <=>    TX/RX    <=>   ={Module}=  -+-----------+

The module will sit there on both ends compressing/decompressing...

To be quite honest, it sounds like there will be work involved as the Firewall's holes would have to be punctured to allow the compressed data in and out...throw in NAT/SNAT could make things complicated...

Have a look at this article that I wrote on Codeproject, that code acts as a traffic redirector and could easily be modified to use the compression/decompression scheme..

like image 79
t0mm13b Avatar answered Oct 07 '22 13:10

t0mm13b


As others have said there is no compression built in to the SQL Server TDS Protocol. It's also worth saying that by default there is no encryption either. To enable encryption you must use certificates and specify it in the connection strings.

The easiest solution to solve both issues is to open up a VPN tunnel with encryption and compression enabled. Simple Microsoft PPTP solves both issues and is easy to setup.

like image 39
Joel Mansford Avatar answered Oct 07 '22 14:10

Joel Mansford


I don't think there is compression implemented in SQL server connection - if you are in need of compressing data, you should use web service and HTTP compression when communication with the service.

like image 40
Axarydax Avatar answered Oct 07 '22 14:10

Axarydax


I know this question is over a year old but I found myself looking for this so I thought I would share what I found. There is this (quite expensive) software that compresses SQL server traffic. I am testing it at the moment for one of my clients, it works very well, achieving 60% compression ratios on average.

http://www.nitrosphere.net/store/nitroaccelerator

It is also compatible with clients that don't have this service installed.

like image 29
simon Avatar answered Oct 07 '22 15:10

simon


In this case I suggest to use web services or WCF to send the data instead of using connection to the database.

like image 27
Wael Dalloul Avatar answered Oct 07 '22 15:10

Wael Dalloul


Check this out : http://www.toonel.net/tcpany.htm

Btw, I also think that SQL Server itself cannot compress trafic, but, with a network tier within application - you can do the compression there.

like image 26
Denis Biondic Avatar answered Oct 07 '22 14:10

Denis Biondic


if you want to create a tunnel with compression and encryption (can be disabled to save process) without having to create a vpn and also is cross plataform for your delight, here you have one that functions as a client server and using listening ports all life also functions as a firewall as a tunnel to have a single port as a channel to manage remote connections and ports), this tools exists 10 years ago: http://www.winton.org.uk/zebedee/

I'm doing experiments to compress (at level 3) a connection unencrypted SQL Server and I 'm getting good ratios tuneando the level of compression, let the intention that children spend large queries possible data for the limited channel... updated in: https://sourceforge.net/projects/zebedee/

like image 37
ModMa Avatar answered Oct 07 '22 13:10

ModMa


We are currently also testing the NitroSphere software over our WAN network, and we have a 73% compression rate, and a big speed improvement.

My opinion is that the software is actually cheap compared to SQL Server licensing, Riverbed devices and MPLS WAN connections. So for sure have a look if you have bandwidth troubles. It also support encryption but we do not plan on using this since everything will stay on internal MPLS network.

like image 42
Kuny Avatar answered Oct 07 '22 13:10

Kuny