|
From: <ale...@us...> - 2014-11-27 13:52:01
|
Revision: 60300
http://sourceforge.net/p/firebird/code/60300
Author: alexpeshkoff
Date: 2014-11-27 13:51:59 +0000 (Thu, 27 Nov 2014)
Log Message:
-----------
Make zlib allocate memory from our pool
Add Z flag in protocol version for compressed connections
Documentation
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Added Paths:
-----------
firebird/trunk/doc/README.wire.compression.html
Added: firebird/trunk/doc/README.wire.compression.html
===================================================================
--- firebird/trunk/doc/README.wire.compression.html (rev 0)
+++ firebird/trunk/doc/README.wire.compression.html 2014-11-27 13:51:59 UTC (rev 60300)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
+ <TITLE></TITLE>
+ <META NAME="GENERATOR" CONTENT="OpenOffice 4.1.1 (Unix)">
+ <META NAME="AUTHOR" CONTENT="alex ">
+ <META NAME="CREATED" CONTENT="20130531;10003100">
+ <META NAME="CHANGEDBY" CONTENT="Alex Peshkoff">
+ <META NAME="CHANGED" CONTENT="20141127;15401600">
+ <STYLE TYPE="text/css">
+ <!--
+ @page { size: 8.5in 11in; margin: 0.79in }
+ P { margin-bottom: 0.08in }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" DIR="LTR">
+<P STYLE="margin-top: 0.17in; margin-bottom: 0.2in; page-break-after: avoid">
+<FONT FACE="Albany, sans-serif"><FONT SIZE=4>Compressing data passed
+over the wire.</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P>In most of cases compressing data passed over the wire is useless
+– one spends more time to compress a packet of data than to
+pass it over the typical LAN. But for WAN access data compression may
+be rather efficient way to enhance performance, specially when it can
+provide instead package size decrees packages' number decrees –
+that's the case for Firebird when it transfers a lot of data like big
+result set. zlib library (<A HREF="http://www.zlib.net/">http://www.zlib.net/</A>)
+is used by Firebird to compress data passed over the wire.</P>
+<P>By default wire compression is off, to turn it on you should set
+“WireCompression=true” in Firebird configuration on
+client. Compression setting is done by client to let only some
+clients that really need it use compression. Server gets compression
+setting from client when connection is established. Certainly only
+Firebird 3 (or higher) wire protocol supports compression. When
+compression is turned on Z flag is shown in client/server version
+info – for example: LI-T3.0.0.31451 Firebird 3.0 Beta 1/tcp
+(fbs)/P13:Z.</P>
+<P><BR><BR>
+</P>
+<P><BR><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file
Property changes on: firebird/trunk/doc/README.wire.compression.html
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2014-11-27 08:15:16 UTC (rev 60299)
+++ firebird/trunk/src/remote/client/interface.cpp 2014-11-27 13:51:59 UTC (rev 60300)
@@ -1456,8 +1456,7 @@
item_length, items, 0, 0, buffer_length, temp_buffer);
string version;
- version.printf("%s/%s%s", FB_VERSION, port->port_version->str_data,
- port->port_crypt_complete ? ":C" : "");
+ port->versionInfo(version);
MERGE_database_info(temp_buffer, buffer, buffer_length,
DbImplementation::current.backwardCompatibleImplementation(), 3, 1,
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2014-11-27 08:15:16 UTC (rev 60299)
+++ firebird/trunk/src/remote/remote.cpp 2014-11-27 13:51:59 UTC (rev 60300)
@@ -37,6 +37,7 @@
#include "../common/db_alias.h"
#include "firebird/Interface.h"
#include "../common/os/mod_loader.h"
+#include "../jrd/license.h"
#ifdef DEV_BUILD
Firebird::AtomicCounter rem_port::portCounter;
@@ -1360,6 +1361,23 @@
}
}
+void rem_port::versionInfo(Firebird::string& version)
+{
+ version.printf("%s/%s", FB_VERSION, port_version->str_data);
+#ifndef WIRE_COMPRESS_SUPPORT
+ if (port_crypt_plugin)
+ version += ":C";
+#else
+ if (port_crypt_plugin || port_compressed)
+ version += ':';
+ if (port_crypt_plugin)
+ version += 'C';
+ if (port_compressed)
+ version += 'Z';
+#endif
+}
+
+
#ifdef WIRE_COMPRESS_SUPPORT
namespace {
class ZLib
@@ -1402,6 +1420,16 @@
};
Firebird::InitInstance<ZLib> zlib;
+
+ void* allocFunc(void*, uInt items, uInt size)
+ {
+ return MemoryPool::globalAlloc(items * size);
+ }
+
+ void freeFunc(void*, void* address)
+ {
+ MemoryPool::globalFree(address);
+ }
}
#endif // WIRE_COMPRESS_SUPPORT
@@ -1597,16 +1625,16 @@
#ifdef WIRE_COMPRESS_SUPPORT
if (port_protocol >= PROTOCOL_VERSION13 && !port_compressed)
{
- port_send_stream.zalloc = Z_NULL;
- port_send_stream.zfree = Z_NULL;
+ port_send_stream.zalloc = allocFunc;
+ port_send_stream.zfree = freeFunc;
port_send_stream.opaque = Z_NULL;
int ret = zlib().deflateInit(&port_send_stream, Z_DEFAULT_COMPRESSION);
if (ret != Z_OK)
(Firebird::Arg::Gds(isc_random) << "compression stream init error").raise(); // add error code
port_send_stream.next_out = NULL;
- port_recv_stream.zalloc = Z_NULL;
- port_recv_stream.zfree = Z_NULL;
+ port_recv_stream.zalloc = allocFunc;
+ port_recv_stream.zfree = freeFunc;
port_recv_stream.opaque = Z_NULL;
port_recv_stream.avail_in = 0;
port_recv_stream.next_in = Z_NULL;
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2014-11-27 08:15:16 UTC (rev 60299)
+++ firebird/trunk/src/remote/remote.h 2014-11-27 13:51:59 UTC (rev 60300)
@@ -989,6 +989,7 @@
void linkParent(rem_port* const parent);
void unlinkParent();
const Firebird::RefPtr<Config>& getPortConfig() const;
+ void versionInfo(Firebird::string& version);
template <typename T>
void getHandle(T*& blk, OBJCT id)
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2014-11-27 08:15:16 UTC (rev 60299)
+++ firebird/trunk/src/remote/server/server.cpp 2014-11-27 13:51:59 UTC (rev 60300)
@@ -39,7 +39,6 @@
#include "../remote/remote.h"
#include "../common/file_params.h"
#include "../common/ThreadStart.h"
-#include "../jrd/license.h"
#include "../common/classes/timestamp.h"
#include "../remote/merge_proto.h"
#include "../remote/parse_proto.h"
@@ -3746,8 +3745,7 @@
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
{
string version;
- version.printf("%s/%s%s", FB_VERSION, this->port_version->str_data,
- this->port_crypt_complete ? ":C" : "");
+ versionInfo(version);
info_db_len = MERGE_database_info(temp_buffer, //temp
buffer, buffer_length,
DbImplementation::current.backwardCompatibleImplementation(), 4, 1,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|