[
https://issues.apache.org/jira/browse/TS-4897?focusedWorklogId=30016&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-30016
]
ASF GitHub Bot logged work on TS-4897:
--------------------------------------
Author: ASF GitHub Bot
Created on: 30/Sep/16 16:49
Start Date: 30/Sep/16 16:49
Worklog Time Spent: 10m
Work Description: Github user smalenfant commented on the issue:
https://github.com/apache/trafficserver/pull/1050
I've been doing lots of testing and sharing results with @PSUdaemon. I'm
seeing the issue when using fairly big ram_cache with the normal pages under
Centos 6. I'm not using SSL at all. I've been troubleshooting this since I
posted the `ATS blocking at half hour interval` in the traffic server forum.
Test system was multiple Dell R720/730xd with 24 disks and 192GB of memory.
- `CONFIG proxy.config.cache.ram_cache.size INT 103079215104`. => 96GB
Using Centos 6.8 `2.6.32-642.4.2` (version doesn't matter, any variant of
Centos 6.7 and 6.8), I would run HLS streaming to fill up the entire ram_cache.
At some point (few hours) I would start to see system CPU spikes every 22
minutes. If you run a `perf top` during that time, you can see high activity by
`try_to_unmap_anon`.
Then, trying to stop traffic server would take about an hour and there
`try_to_unmap_anon` would show up during the entire time.
Now, I then tested with Centos 7 under the same conditions. I didn't see
the CPU Spikes and didn't experience the traffic server stop issue.
To make this work with Centos 6, I then configured Huge Pages to stop using
anonymous pages. I've set the amount of reserved Huge Pages to 48000 (96GB) and
gave it a surplus of 8000 pages (16GB).
```
vm.nr_hugepages = 48000
vm.nr_overcommit_hugepages = 8000
```
You also have to enable Huge Pages `CONFIG proxy.config.allocator.hugepages
INT 1`.
Reboot the server to ensure the pages gets allocated without being
fragmented (reserved one).
You can then observe the problem is gone (hopefully) and also that the
PageTables size is kept to a reasonable size. (Was >200,000kB before).
```
[root@myserver ~]# cat /proc/meminfo | grep Page
AnonPages: 1176352 kB
PageTables: 9836 kB
AnonHugePages: 0 kB
HugePages_Total: 48651
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 651
```
Not sure how related to madvise, but those are the way to get it working
and keep performance at a good level. Feel free to comment or ask questions.
Issue Time Tracking
-------------------
Worklog Id: (was: 30016)
Time Spent: 2h 10m (was: 2h)
> Unbound growth of number of memory maps for traffic_server under SSL
> termination load when ssl_ticket_enabled=0
> ---------------------------------------------------------------------------------------------------------------
>
> Key: TS-4897
> URL: https://issues.apache.org/jira/browse/TS-4897
> Project: Traffic Server
> Issue Type: Bug
> Components: TLS
> Reporter: Can Selcik
> Assignee: Phil Sorber
> Priority: Blocker
> Fix For: 7.1.0
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> The number of {{\[anon\]}} memory regions mapped to the {{traffic_server}}
> process displays unbound growth until the kernel thresholds are reached and
> the process is terminated.
> This happens when ATS is used to terminate SSL and {{ssl_ticket_enabled=0}}
> in {{ssl_multicert.config}}.
> We've experienced this issue on our staging and production hosts and were
> able to replicate it with the above configuration under high volume HTTPS
> load. We didn't experience this with {{5.2.x}} and it will make sense why at
> the end.
> While generating {{https}} traffic with {{siege}} or {{ab}}, the issue can be
> observed with:
> {{watch "pmap $(pidof traffic_server) | wc -l"}}
> {{git bisect}} pointed us to: <TS-3883: Fix madvise>
> Turns out a no-op {{ats_madvise}} hides the symptoms of the issue.
> Going in deeper, we realize that {{ssl_ticket_enabled}} option is relevant
> because after enabling the {{ssl.session_cache}} tag, we see that ATS doesn't
> manage its own session cache for SSL, it is done by the library instead. In
> that case, the code path doing the problematic allocation within ATS doesn't
> get executed often since OpenSSL takes care of the session tokens.
> But why does this happen? It happens because {{MADV_DONTDUMP}} is passed to
> {{posix_madvise}} even though {{MADV_DONTDUMP}} is not a valid flag for
> {{posix_madvise}} as it is not a drop-in replacement to {{madvise}}.
> Looking at {{<bits/mman.h>}}:
> {noformat}
> 87 /* Advice to `madvise'. */
> 88 #ifdef __USE_BSD
> 89 # define MADV_NORMAL▸ 0▸ /* No further special treatment. */
> 90 # define MADV_RANDOM▸ 1▸ /* Expect random page references. */
> 91 # define MADV_SEQUENTIAL 2▸ /* Expect sequential page references.
> */
> 92 # define MADV_WILLNEED▸ 3▸ /* Will need these pages. */
> 93 # define MADV_DONTNEED▸ 4▸ /* Don't need these pages. */
> 94 # define MADV_REMOVE▸ 9▸ /* Remove these pages and resources.
> */
> 95 # define MADV_DONTFORK▸ 10▸ /* Do not inherit across fork. */
> 96 # define MADV_DOFORK▸ 11▸ /* Do inherit across fork. */
> 97 # define MADV_MERGEABLE▸ 12▸ /* KSM may merge identical pages. */
> 98 # define MADV_UNMERGEABLE 13▸ /* KSM may not merge identical pages.
> */
> 99 # define MADV_DONTDUMP▸ 16 /* Explicity exclude from the core
> dump,
> 100 overrides the coredump filter
> bits. */
> 101 # define MADV_DODUMP▸ 17▸ /* Clear the MADV_DONTDUMP flag. */
> 102 # define MADV_HWPOISON▸ 100▸ /* Poison a page for testing. */
> 103 #endif
> {noformat}
> However {{posix_madvise}} takes:
> {noformat}
> 107 # define POSIX_MADV_NORMAL▸ 0 /* No further special treatment. */
> 108 # define POSIX_MADV_RANDOM▸ 1 /* Expect random page references.
> */
> 109 # define POSIX_MADV_SEQUENTIAL▸ 2 /* Expect sequential page
> references. */
> 110 # define POSIX_MADV_WILLNEED▸ 3 /* Will need these pages. */
> 111 # define POSIX_MADV_DONTNEED▸ 4 /* Don't need these pages. */
> {noformat}
> Also {{posix_madvise}} and {{madvise}} can both be present on the same
> system. However they do not have the same capability. That's why {{Explicity
> exclude from the core dump, overrides the coredump filter bits}}
> functionality isn't achievable through {{posix_madvise}}.
> Will post a PR momentarily.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)