GitHub user bgaff opened a pull request:
https://github.com/apache/trafficserver/pull/556
Adding STL Allocator which uses io bufs
This is something that seems to come up at every summit and I always
promise to prototype it. Ahead of the next summit I'd like to begin discussions
around the idea of actually making this happen. This pull request (while not
yet referencing a TS ticket) adds an STL allocator which uses io bufs if
possible falling back to std::allocator for large allocations. As an example I
also modified the SPDY code to use this new allocator instead of the default
allocator. So I'd love thoughts on this, should we go forward?
cc. @jpeach @SolidWallOfCode @zwoop @jacksontj
The result below is from just switching out the SPDY code and with only ONE
request, needless-to-say a large number of allocations happen that can be
deferred to an io buf.
```
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 30 at location
0x7fffd004bf80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 34 at location
0x7fffd004bf00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 16 at location
0x7fffd004be80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 32 at location
0x7fffd004be00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 28 at location
0x7fffd004bd80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 32 at location
0x7fffd004bd00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 16 at
location 0x7fffd004bc80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 30 at location
0x7fffd004bc80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 26 at location
0x7fffd004bc00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 64 at location
0x7fffd004bb80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 32 at
location 0x7fffd004bb00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 32 at location
0x7fffd004bb00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 30 at location
0x7fffd004ba80
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 33 at location
0x7fffd004ba00
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 33 at location
0x7fffd004b980
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 128 at location
0x7fffd004b900
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 64 at
location 0x7fffd004b880
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 31 at location
0x7fffd004b880
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 28 at location
0x7fffd004b800
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 40 at location
0x7fffd004b780
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 38 at location
0x7fffd004b700
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 35 at location
0x7fffd004b680
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 42 at location
0x7fffd004b600
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 48 at location
0x7fffd004b580
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 35 at location
0x7fffd004b500
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 45 at location
0x7fffd004b480
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator) Allocating
a block from iobuf index 0 (block size 128), alloc size = 43 at location
0x7fffd004b400
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 45 at
location 0x7fffd004b380
[Mar 1 23:50:12.861] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 35 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 30 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 32 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 30 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 32 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 33 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 28 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 31 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 38 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 40 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 42 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 35 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 128 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 43 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 34 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 26 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 30 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 28 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 33 at
location 0x7fffd004b380
[Mar 1 23:50:13.309] Server {0x7fffee0fc700} DIAG: (allocator)
Deallocating a block to iobuf index 0 (block size 128), alloc size = 48 at
location 0x7fffd004b380
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bgaff/trafficserver master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/556.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #556
----
commit e862fbf214a88e6fa66276de7f9dd198db5ac2ef
Author: Brian Geffon <[email protected]>
Date: 2016-03-02T07:56:08Z
Adding STL Allocator which uses IoBufs
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---