[ 
https://issues.apache.org/jira/browse/CASSANDRA-17780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17780:
------------------------------------------
    Description: 
I noticed that there was this log message when I started a Cassandra node on a 
machine in AWS on Ubuntu Jelly (22.04).
{code:java}
WARN  [main] 2022-07-27 11:04:16,731 StartupChecks.java:200 - jemalloc shared 
library could not be preloaded to speed up memory allocations
{code}
Hence, I went ahead and I tried to install that package, on 22.04, 
{code:java}
$ apt search libjemalloc
Sorting... Done
Full Text Search... Done
libjemalloc-dev/jammy 5.2.1-4ubuntu1 amd64
    development files and documentation for jemalloc

libjemalloc2/jammy,now 5.2.1-4ubuntu1 amd64
    general-purpose scalable concurrent malloc(3) implementation {code}
So I did apt install libjemalloc2.

But the problems didnt go away because cassandra script didnt recognised it. 
The value of JVM property the jemalloc startup check is reading from is an 
environment property called CASSANDRA_LIBJEMALLOC (1) which is set by us 
looking into various library paths, trying to find "libjemalloc.so.1"(2). But 
there is no "1" version of it. We have version "2".
{code:java}
$ sudo dpkg -L libjemalloc2
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libjemalloc.so.2  <---- our tasty libjemalloc
/usr/share
/usr/share/doc
/usr/share/doc/libjemalloc2
/usr/share/doc/libjemalloc2/README
/usr/share/doc/libjemalloc2/changelog.Debian.gz
/usr/share/doc/libjemalloc2/copyright{code}
(1) [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L160]
(2) [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L157]

I checked what Debian is offering and Bullseye and Buster do not have 
libjemalloc1 anymore, they have version 2, 1 is gone. Strech and Jessie have 
version 1 and not 2 (obviously). Ubuntu Jelly has 2, I am not sure when they 
started to ship 2 instead of 1 but I assume that if a user runs Cassandra on 
"anything recent", this is broken, jemalloc is not used and I think that 
performance can suffer quite significantly.

This logic is present from 3.0 onwards.

The patch should fix this and it should take both versions into account. I will 
provide patch with my solution shortly.

  was:
I noticed that there was this log message when I started a Cassandra node on a 
machine in AWS on Ubuntu Jelly (22.04).

{code}
WARN  [main] 2022-07-27 11:04:16,731 StartupChecks.java:200 - jemalloc shared 
library could not be preloaded to speed up memory allocations
{code}

Hence, I went ahead and I tried to install that package, on 22.04, 
{code:java}
$ apt search libjemalloc
Sorting... Done
Full Text Search... Done
libjemalloc-dev/jammy 5.2.1-4ubuntu1 amd64
    development files and documentation for jemalloc

libjemalloc2/jammy,now 5.2.1-4ubuntu1 amd64
    general-purpose scalable concurrent malloc(3) implementation {code}
So I did apt install libjemalloc2.

But the problems didnt go away because cassandra script didnt recognised it. 
The value of JVM property the jemalloc startup check is reading from is an 
environment property called CASSANDRA_LIBJEMALLOC (1) which is set by us 
looking into various library paths, trying to find "libjemalloc.so.1"(2). But 
there is no "1" version of it. We have version "2".
{code:java}
$ sudo dpkg -L libjemalloc2
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libjemalloc.so.2  <---- our tasty libjemalloc
/usr/share
/usr/share/doc
/usr/share/doc/libjemalloc2
/usr/share/doc/libjemalloc2/README
/usr/share/doc/libjemalloc2/changelog.Debian.gz
/usr/share/doc/libjemalloc2/copyright{code}

(1) [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L160]
(2) [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L157]

I checked what Debian is offering and Bullseye and Buster do not have 
libjemalloc1 anymore, they have version 2, 1 is gone. Strech and Jessie have 
version 1 and not 2 (obviously). Ubuntu Jelly has 2, I am not sure when they 
started to ship 2 instead of 1 but I assume that if a user runs Cassandra on 
"anything recent", this is broken, jemalloc is not used and I thing that 
performance can suffer quite significantly.

This logic is present from 3.0 onwards.

The patch should fix this and it should take both versions into account. I will 
provide patch with my solution shortly.


> libjemalloc2 is not detected by cassandra script
> ------------------------------------------------
>
>                 Key: CASSANDRA-17780
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17780
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Scripts
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> I noticed that there was this log message when I started a Cassandra node on 
> a machine in AWS on Ubuntu Jelly (22.04).
> {code:java}
> WARN  [main] 2022-07-27 11:04:16,731 StartupChecks.java:200 - jemalloc shared 
> library could not be preloaded to speed up memory allocations
> {code}
> Hence, I went ahead and I tried to install that package, on 22.04, 
> {code:java}
> $ apt search libjemalloc
> Sorting... Done
> Full Text Search... Done
> libjemalloc-dev/jammy 5.2.1-4ubuntu1 amd64
>     development files and documentation for jemalloc
> libjemalloc2/jammy,now 5.2.1-4ubuntu1 amd64
>     general-purpose scalable concurrent malloc(3) implementation {code}
> So I did apt install libjemalloc2.
> But the problems didnt go away because cassandra script didnt recognised it. 
> The value of JVM property the jemalloc startup check is reading from is an 
> environment property called CASSANDRA_LIBJEMALLOC (1) which is set by us 
> looking into various library paths, trying to find "libjemalloc.so.1"(2). But 
> there is no "1" version of it. We have version "2".
> {code:java}
> $ sudo dpkg -L libjemalloc2
> /.
> /usr
> /usr/lib
> /usr/lib/x86_64-linux-gnu
> /usr/lib/x86_64-linux-gnu/libjemalloc.so.2  <---- our tasty libjemalloc
> /usr/share
> /usr/share/doc
> /usr/share/doc/libjemalloc2
> /usr/share/doc/libjemalloc2/README
> /usr/share/doc/libjemalloc2/changelog.Debian.gz
> /usr/share/doc/libjemalloc2/copyright{code}
> (1) 
> [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L160]
> (2) 
> [https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L157]
> I checked what Debian is offering and Bullseye and Buster do not have 
> libjemalloc1 anymore, they have version 2, 1 is gone. Strech and Jessie have 
> version 1 and not 2 (obviously). Ubuntu Jelly has 2, I am not sure when they 
> started to ship 2 instead of 1 but I assume that if a user runs Cassandra on 
> "anything recent", this is broken, jemalloc is not used and I think that 
> performance can suffer quite significantly.
> This logic is present from 3.0 onwards.
> The patch should fix this and it should take both versions into account. I 
> will provide patch with my solution shortly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to