# gzip string compression?

**URL:** <https://community.f5.com/t/gzip-string-compression/2354>\
**Category:** Technical Forums\
**Tags:** design, performance, irules, devops, ltm, application-delivery\
**Created:** [February 16, 2015, 7:39pm UTC](https://community.f5.com/t/gzip-string-compression/2354 "2015-02-16T19:39:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_X\_186825](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@Jason\_X\_186825](https://community.f5.com/u/Jason_X_186825)\
**Post date:** [February 16, 2015, 7:39pm UTC](https://community.f5.com/t/gzip-string-compression/2354/1 "2015-02-16T19:39:55Z")

</div>

Hi,

I’ve been asked to send a JSON message containing various http headers and an XML payload from the HTTP request and HTTP response. Basically Logging the API calls and replies for downstream analytics. The XML payload is quite large most of the time and can be up to 5MB in size. Inspired by [Hoolio’s _Log large HTTP payloads in chunks locally and remotely_](https://devcentral.f5.com/wiki/iRules.Log-large-HTTP-payloads-in-chunks-locally-and-remotely.ashx) iRule I’m using HSL to send the JSON to a network server that’s connected via Gig-E. However based on the amount of requests and responses in uncompressed form we are looking to get speeds of 6Gbps which will easily exceed the link speed. So I was looking to perform some form of compression on the JSON message that’s being sent out using HSL::send but there doesn’t seem to be a iRules method, function or library to perform string compression.

Anyone have any ideas or suggestions?

Can tcl libraries be manually added to a F5-BigIP? ie: in /usr/share/tcl8.4/ ?

Cheers, Jason

**UPDATED:**

Sadly according to this [sol15434: Overview of the HTTP Compression profile](https://support.f5.com/kb/en-us/solutions/public/15000/400/sol15434.html) when activated by a COMPRESS::enable in an iRule only compresses the HTTP **Response**. 😞

```tcl
Selective Compression: When checked (enabled), HTTP compression is performed only when a configured iRule contains the COMPRESS::enable command. When cleared (disabled), compression is performed according to the other compression settings specified in the HTTP Compression profile.

```

Note: Data compression only compresses **HTTP server responses** , and not client requests.

---

<div class="post-metadata">

**Author:** ![StephanManthey](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@StephanManthey](https://community.f5.com/u/StephanManthey)\
**Post date:** [February 16, 2015, 8:06pm UTC](https://community.f5.com/t/gzip-string-compression/2354/2 "2015-02-16T20:06:56Z")

</div>

Hi,

in case you are on v11 you can use iFiles.

The size limit is 4 MByte.

An iFile can be imported via tmsh to the TMOS filestore and is available in an iRule.

Place the file into a dedicated directory and run the following (works for a list of files):

```tcl
for file in `ls`; do ls -l | grep -iv '^total' | echo "tmsh create sys file ifile "$file" source-path file:"`pwd`"/"$file | bash -x; done

for file in `ls`; do ls -l | grep -iv '^total' | echo "tmsh create ltm ifile "$file" file-name "$file | bash -x; done

```

Maybe an automatism to compress and import into filestore is a workaround?

Thanks, Stephan

---

<div class="post-metadata">

**Author:** ![Mohamed\_Lrhazi\_1](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Mohamed\_Lrhazi\_1](https://community.f5.com/u/Mohamed_Lrhazi_1)\
**Post date:** [February 17, 2015, 10:45am UTC](https://community.f5.com/t/gzip-string-compression/2354/3 "2015-02-17T10:45:58Z")

</div>

am not from F5, but I think I can safely say that No, you cannot import additional TCL libs into iRules. Only what documented on devcentral is available, which is a small subset.

a wild idea maybe if you could send your data to an http virtual server which performs compression when talking to your remote target servers.
