Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 2C26B781089 for <~alpine/devel@lists.alpinelinux.org>; Tue, 21 Jun 2022 07:32:56 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id kq6so25532066ejb.11 for <~alpine/devel@lists.alpinelinux.org>; Tue, 21 Jun 2022 00:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=HZh5Bmdh3pJhM6rPYCr2Ypkx85qTUeYmb3hIw0dVycU=; b=HyaI+4zhYtMtJLf1hfMEpgS5/Mj/bHnf1GdqiXqGSyhHG5L02YyVtiufko4xQjr0Ug kAC253ZpSAJns8mVOSGLI9vZuf/HpdKLOnczBo85zcHgxypS9rdHjhugCmPtmZr4y4he 70tVH+GPGbnhq1f8P9tVb2CtxBph3dPGcE6+qS8RyS7YCJqEowAan/uMNqC/1Raauvjp LSKyvMc72FfS4N6jc+2TLbASBhFmJgPu48lEW1xlsP5UUfdXIDhBgoe0NIK2P+5EIkMq ZOuiLwUNOEmQa3yD+oMYw+00O0WV0hDSYZWV7FjHXQ2BDIx+KoxihvfCKir0Nxu/jPNX EHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=HZh5Bmdh3pJhM6rPYCr2Ypkx85qTUeYmb3hIw0dVycU=; b=Vu1xAmyRxTM/ZA8pLuuC81wJHriGsvXEV5DuvDukvFeoVKBKht/jeahphoCjMLss70 POT4cvXJbHTH3xqbHDqkXAf+EAcVjPWYgXs6FG50uEz6yYltN1fT5ViWizBbCVwOtC7N yYLaUgk8JAnzh4ZDIexg5F5fibIcPQrCxORJjqAfV66CgQDyNml4kMpMDV2PFW+fuTae nddX9npNsLJ6EDgfRMUjQBcLPiTzuKpKAEFSL54XgA35mhWr9Hz0noU0tFllGJVaKB8m 28aZGnKlzF7Nx7OL+d4sji+v+imJ/tuDJsGn20Q4kCtOUoKTeQetSsvNSLUK/N/6tyvV G7tQ== X-Gm-Message-State: AJIora+LX6gv8JJNMQmNOn2d3fFmez83GL+XR5L2xopku+kVKqxfIQTM AEHuRT9NQBNyMoQNPeRZ5oJHtvY5LKjkpektWzTPlt6Gpso= X-Google-Smtp-Source: AGRyM1sS0iTMbvzxjy1Hrz70RL6EYoIGfrUSzaC9PBrdZSM/4rmNyHdlvIBYvGdoP8IT37LuABSimj6kBj7DbkOCXfA= X-Received: by 2002:a17:906:7309:b0:722:e0b9:5b29 with SMTP id di9-20020a170906730900b00722e0b95b29mr2869908ejc.166.1655796775766; Tue, 21 Jun 2022 00:32:55 -0700 (PDT) MIME-Version: 1.0 From: Tomas Kolda Date: Tue, 21 Jun 2022 09:32:44 +0200 Message-ID: Subject: Native Alpine GLibc support (NEW) To: ~alpine/devel@lists.alpinelinux.org Content-Type: text/plain; charset="UTF-8" Trying to send email again from my personal email as my previous post was marked as invalid. Hi, I know that this topic is very sensitive in Alpine, but please let me describe first what and why we would like to achieve. 1. We love to use Alpine for our containers. Alpine has very fresh versions packages, it is very easy to use, versatile, customizable and clean. Basically only superlatives. 2. Our applications are mostly Java. But many of our jars are JNIs and are compiled against glibc. 3. We were using Alpine with Glibc hacks like https://github.com/sgerrand/alpine-pkg-glibc It was working nice until we ran into a problem where some other library was trying to load other native library and it started crashing. 4. We have switched to native MUSL based everywhere (Java, libs, etc.). I was happy that it was possible, but I was surprised that the performance of our applications degraded a lot. Our application is heavily multithreaded. After long investigation I have found that degradation is because of poor implementation of pthread locks in muslc. Probably the advantage of glibc is the adaptive locking feature and maybe other types of tunings. In our example application spends with muslc build 600% CPU in kernel and 200% in user space, but on glibc 100% CPU in kernel and 700% in user space (where 100% means 1 CPU core). Yes it is that huge difference. At this point I had many options of what to do and one I would like to describe. - I started thinking that I would like to have a variant of Alpine with glibc. Everything else is the same and great as usual. - After the initial painful bootstrap to get bare minimum to be able to compile I got the first 300 packages built (enough for us) with only a few tweaks in some packages that are explicitly applying MUSL patches. I simply disabled these. - Now our application is running fast again with native builds and no tweaks. - I know glibc is maybe a little bit, but we simply need performance and compatibility. Example of change in procps. There is a tweak to make it work in MUSL so I simply conditionally disable it: if [ "$CLIBC" != "glibc" ]; then export LIBS="$LIBS -lintl" fi I would love to have the patches part of the main branch so I do not need to do merges from time to time. I can only dream that the Alpine community will provide the official build as well. I think that more people would like that when I look at a number of projects around hacking glibc in Alpine. Please do not take it as a heretical thought. It came as a need. What do you think about the project? I can share my changes in some branch or in github. I can also share initial 3.16 binaries to have an easier bootstrap. It was really a pain. Thank you very much for your project and the hard work you put into it. Tomas