[MCOL-4132] systemd startup logic suggestions Created: 2020-06-30 Updated: 2020-11-21 Resolved: 2020-11-20 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | installation |
| Affects Version/s: | None |
| Fix Version/s: | 5.4.1 |
| Type: | Task | Priority: | Major |
| Reporter: | Daniel Black | Assignee: | Roman |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
paths in scripts need to be at least configurable. mariadb-columnstore/usr/bin/mariadb-columnstore-start.sh
This is horrible. Use Requires or similar. Maybe the `Partof` in other services forms the heirarcy ok. What I've generally found with systemd is to specify something if required. patching both ends of the service just gets messy. Don't sleepUse of sleep like:
is an ugly fragile hack. Use of Type=simple isn't robust way to handle the dependencies to other services. Ways to fix this in preferred order are: a) Use `Type=notify` When using this the server will be linked against a systemd server component and use sd_notify to communicate when it is ready. The mariadb server uses this since 10.1.8 so see how it does it. READY is sent in sql/mysqld.cc just before the loop that accepts connections. b) Type=dbus If you are consider moving all communication to dbus rather than focusing development effort on client/server protocols. c) Use `Type=forking`. When the main process is ready it should fork. d) Use ExecStartPost To have some sort of wait condition (e.g. file created, socket exists etc). LD_PRELOAD jemalloc
So if the libjemalloc is in the loader cache it should be used? This isn't a good idea because:
ExecStop kill
Don't do this. This is close to the default anyway so can be omitted. clearShm
Is redirecting the output to null the best idea? DescriptionThe description of these services is a bit brief. good bitsGood use of PartOf Feature enhancementsmcs-workernode.servicethis is a good case for Service Template where the instance name is the worker identifier. mariadb.serviceThink how you want the dependency with the mariadb.service to show up as. `PartOf` again? |
| Comments |
| Comment by Daniel Black [ 2020-06-30 ] | ||||||
|
Not sure how to execute After a service you are PartOf
| ||||||
| Comment by Roman [ 2020-07-13 ] | ||||||
|
I agree that systemd calls for significant changes however the ways suggested aren't appropriate. | ||||||
| Comment by Daniel Black [ 2020-07-17 ] | ||||||
|
Thanks for your consideration. Socket activation sounds like a good plan. I should revive my archived code on that for the MariaDB server too. I assume things like exemgr perform multiple things and agree that Type=notify is hard where there is more than one ready state. Jemalloc, static linking to system libraries tends to violate distro packaging rules. If you can provide a dynamic link option that would be useful. Are you definitely getting a jemalloc benefit? I've seen some blogs that proclaim glibc has improved the malloc preformance significantly even with a few year old versions. I totally agree that some of the dependency relations are hard to deduce. Timeout of 0 going to SIGKILL immediately sounds plausible. mcs-workernode.service - good to know. I was more thinking for testing multiple worker nodes on a single hardware but this isn't an end user consideration so engineering it for that seems harmful. Good to know its a separate software. I'll look at seeing if in the packaging of the columns store plugin, a mariadb.service extension depends on the right mcs service (or socket eventually). I didn't fully get to a running mcs so please forgive errors and assumptions. I hope to get a more complete understand in the near future. | ||||||
| Comment by Roman [ 2020-07-20 ] | ||||||
|
MCS .so and binaries aren't statically but dynamically linked against system libraries and yes we benefit using jemalloc. The default Linux memory allocator allocates a number of pools by default and doesn't return anonymously memory mapped segments back to the system. From application perspective this looks like a mem leak. This happens when software aggresivelly allocates/deallocates considirable amount of memory. | ||||||
| Comment by Gregory Dorman (Inactive) [ 2020-07-22 ] | ||||||
|
1.5.4 codeline includes a number of temporary parts, which need to be corrected. The bash file was introduced as a last minute workaround for a self-inflicted problem ("race condition" when starting up MCS component processes from the mariadb-columnstore.service, due to lack of proper synchronization of starting sequence. Likewise 2 seconds sleeps were injected to temporarily avoid the problem. Both are to be eliminated by means of properly using socket activation method. | ||||||
| Comment by Roman [ 2020-11-20 ] | ||||||
|
Most of the suggestions had made its way into the code base so danblack thank you for the suggestions. We left some bits unchanged though. | ||||||
| Comment by Daniel Black [ 2020-11-20 ] | ||||||
|
> We might start building and ship our own version of jemalloc soon. Doing so will incur the rage and hatred of every distribution packager. | ||||||
| Comment by Roman [ 2020-11-21 ] | ||||||
|
Unfortunatelly for them I'm happy with that |