dockserver / container

GNU General Public License v3.0
0 stars 2 forks source link

Wäre truncate nicht einfacher ?? #102

Closed doob187 closed 1 year ago

doob187 commented 1 year ago

https://github.com/dockserver/container/blob/09d24c7d4e2a48ecd0cdeedd35c042c54c915c42/apps/docker-uploader/root/etc/cont-init.d/50-setup#L256

The TRUNCATE TABLE statement in SQL is a Data Definition Language (DDL) operation that labels a table's extents for DE allocation (empty for reuse). This procedure removes all data from a table easily, usually bypassing a variety of integrity checking mechanisms.

drag0n141 commented 1 year ago

Wenn ich richtig gesehen habe gibt es in Sqlite kein Truncate Command in Sqlite da ist das Delete schon Richtig. 😊

doob187 commented 1 year ago

Mir kommt es so vor das der uploader

Zwischen einem und dem nächsten bei 10TB belegt knappe 2 min braucht und den nächsten hochladen

doob187 commented 1 year ago

Screenshot_20230101_232329_Chrome

drag0n141 commented 1 year ago

Wenn die Files nicht gleichzeitig vorhanden sind wird ja wie vorher auch 120 Sekunden gewartet. Daher kommt diese Zeit zustande :)

drag0n141 commented 1 year ago

Ah ne ich denke es liegt daran das wenn man Files vorhanden hat er ja jedes mal immer wieder alle einliest und in die Datenbank schreiben möchte. Denke wenn man da 10TB Files liegen hat dauert das leider entsprechend einen Moment. Ich mach später mal ein Release fertig wo das eventuell schneller gehen soll :)

drag0n141 commented 1 year ago

Wenn es geht teste den Release mal :) ghcr.io/drag0n141/docker-uploader:dev2

doob187 commented 1 year ago

[2023/01/02 12:04:59] [Uploader] -> Starting Uploader - GDSA <-

02.01.2023 12:16:01 [2023/01/02 12:16:01] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E05 - Im With the Band [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

02.01.2023 12:23:32 [2023/01/02 12:23:32] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E15 - Discos and Dragons [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

02.01.2023 12:30:56 [2023/01/02 12:30:56] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E11 - The Garage Door [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

doob187 commented 1 year ago

Ich hab auch auf Transfer = 4 stehen aber das missachtet der auch komplett

drag0n141 commented 1 year ago

Das missachtet er nicht, er braucht aber zwischen jedem File wieder 2 Minuten weil er deinen kompletten /mnt/downloads Ordner immer wieder erneut in die Datenbank schreiben möchte.

Läuft der :dev2 Release besser/schneller?

doob187 commented 1 year ago
[2023/01/02 12:54:46] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E10 - Looks and Books [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

02.01.2023 13:02:28
[2023/01/02 13:02:28] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E01 - Pilot [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 1.9GiB <-

02.01.2023 13:10:26
[2023/01/02 13:10:26] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E18 - Noshing and Moshing [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

02.01.2023 13:18:34
[2023/01/02 13:18:34] [Uploader] -> ✅ Upload successful Freaks and Geeks (1999) - S01E07 - Girlfriends and Boyfriends [tvdb-76321] [x264-Bluray-720p AC3-2.0].mkv with Size 2.0GiB <-

Nicht wirklich sogar langsamer als vorher

doob187 commented 1 year ago

Kriegst du es so hin dann wenn mehr als 5 TB belegt sind

Das er nicht jedes Mal die DB neu einlesen soll

Einmal dann lass laufen

Da er doch die Daten eh no hnal Prüft ob sie verfügbar sind

Evtl als Variablen??

Wenn X ist größer als 5TB dann lies nur einmal ein

Für Leute mit großen Speicher und lange halte smzwiten ist es nicht ideal wenn der immer und immer wieder die DB neu schreibt

drag0n141 commented 1 year ago

Teste mal hab umgebaut :)

drag0n141 commented 1 year ago

Hatte ein Fehler drin, mach nochmal ein Redeploy :)

drag0n141 commented 1 year ago

Ok das geht so auch noch nicht, muss gerade mal testen. Ich sag Bescheid wenn du nochmal testen kannst :)

doob187 commented 1 year ago

Okqy

drag0n141 commented 1 year ago

Boah wie mich die scheiße genervt hat haha. Sollte jetzt funktionieren teste bitte mal :) er ließt jetzt einmal ein und beim nächsten listfiles Excluded er die Files die schon in der Datenbank vorhanden sind. Daher sollte das nun deutlich schneller laufen.

doob187 commented 1 year ago

Jo ich teste mal

Mal gucke ob es besser läuft

doob187 commented 1 year ago

[2023/01/02 16:01:00] [Uploader] -> ✅ Upload successful Community (2009) - S04E03 - Conventions of Space and Time [tvdb-94571] [x264-WEBDL-1080p AC3-5.1].mkv with Size 2.2GiB <- 02.01.2023 16:01:07 /app/uploader/function.sh: line 373: /bin/grep: Argument list too long

02.01.2023 16:01:09 [2023/01/02 16:01:09] [Uploader] -> ✅ Upload successful Community (2009) - S04E08 - Herstory of Dance [tvdb-94571] [x264-WEBDL-1080p AC3-5.1].mkv with Size 2.1GiB <-

02.01.2023 16:01:25 /app/uploader/function.sh: line 373: /bin/grep: Argument list too long

doob187 commented 1 year ago

Ist um einiges schneller Aber zeigt halt diesen Fehler an

drag0n141 commented 1 year ago

Ok, aber schon mal gut zu wissen das es theoretisch funktioniert jetzt nur noch verfeinern :)

doob187 commented 1 year ago

02.01.2023 16:15:10 grep: (2023): No such file or directory 02.01.2023 16:15:10 grep: S01E07: No such file or directory 02.01.2023 16:15:10 grep: Pink: No such file or directory 02.01.2023 16:15:10 grep: [tvdb-410092]: No such file or directory 02.01.2023 16:15:10 grep: [x264-WEBDL-1080p: No such file or directory 02.01.2023 16:15:10 grep: EAC3-5.1].mkv: No such file or directory 02.01.2023 16:15:10 grep: TV/Greys Anatomy (2005) [tvdb-73762]/Season 11/Greys: No such file or directory 02.01.2023 16:15:10 grep: Anatomy: No such file or directory 02.01.2023 16:15:10

drag0n141 commented 1 year ago

Wie viele Files hast du in deinem /mnt/downloads?

doob187 commented 1 year ago

Weiss gar nicht Glaub 1800 - 2000 oder mehr

Doch was mehr

doob187 commented 1 year ago

14967

Include download von sab

12292 anime 2529 tv&4k 20 Movies&4k

drag0n141 commented 1 year ago

Teste nochmal :)

doob187 commented 1 year ago

Jo bin dabei

doob187 commented 1 year ago

/app/uploader/function.sh: line 386: ${which rm}: bad substitution 02.01.2023 16:37:45 [2023/01/02 16:37:45] [Uploader] -> Starte Uploader - GDSA <- 02.01.2023 16:37:47 /app/uploader/function.sh: line 386: ${which rm}: bad substitution 02.01.2023 16:37:47 [2023/01/02 16:37:47] [Uploader] -> Starte Uploader - GDSA <- 02.01.2023 16:37:49 /app/uploader/function.sh: line 386: ${which rm}: bad substitution 02.01.2023 16:37:50 [2023/01/02 16:37:50] [Uploader] -> Starte Uploader - GDSA <- 02.01.2023 16:37:52 /app/uploader/function.sh: line 386: ${which rm}: bad substitution 02.01.2023 16:37:52 [2023/01/02 16:37:52] [

drag0n141 commented 1 year ago

Ist schon geändert du warst zu schnell :D

doob187 commented 1 year ago

Jo teste nun

doob187 commented 1 year ago

Jo läuft bis jetzt

Macht auch zwei simultan gerade Ohne error

doob187 commented 1 year ago

[2023/01/02 17:27:24] [Uploader] -> ✅ Upload successful The Munsters (1964) - S02E22 - Zombo [tvdb-77280] [x264-HDTV-1080p AC3-2.0].mkv with Size 817MiB <-

02.01.2023 17:30:16
[2023/01/02 17:30:16] [Uploader] -> ✅ Upload successful Cosmos (2014) - S02E12 - Coming of Age In The Anthropocene [tvdb-260586] [h264-WEBDL-1080p EAC3-5.1].mkv with Size 2.5GiB <-

02.01.2023 17:30:20
[2023/01/02 17:30:20] [Uploader] -> ✅ Upload successful Cosmos (2014) - S02E09 - Magic Without Lies [tvdb-260586] [h264-WEBDL-1080p EAC3-5.1].mkv with Size 2.6GiB <-

02.01.2023 17:31:32
[2023/01/02 17:31:32] [Uploader] -> ✅ Upload successful Cosmos (2014) - S02E10 - A Tale of Two Atoms [tvdb-260586] [h264-WEBDL-1080p EAC3-5.1].mkv with Size 2.9GiB <-

02.01.2023 17:31:37
[2023/01/02 17:31:37] [Uploader] -> ✅ Upload successful Cosmos (2014) - S02E03 - Lost City of Life [tvdb-260586] [h264-WEBDL-1080p EAC3-5.1].mkv with Size 2.9GiB <-
drag0n141 commented 1 year ago

Sieht gut aus würde ich sagen 😊 schneller geht's wahrscheinlich nicht 😅

drag0n141 commented 1 year ago

Jetzt kann ich das mit den Keys auch nochmal angehen da jetzt viel weniger auf der Datenbank gearbeitet wird 😊

doob187 commented 1 year ago

Ja sag wenn ich nochmal pullen soll

Hab noch knapp 8.7 TB in qeue 🤣

drag0n141 commented 1 year ago

Haha mach ich erst morgen, aber ich schreib dir dann 😃

doob187 commented 1 year ago

logtest() { echo -e "$(date +"%F %T") [$1] $2"; }

logtest Check "Checking for script updates."

Ergibt am Ende

2023-01-02 18:00:18 [Check] Checking for script updates.

Würde bestimmt einiges erleichtern wenn es so machen würde Weniger pulls und mehr modular

Wenn zb $1 Error ist kann man es bestimmt auch rot färben

drag0n141 commented 1 year ago

Schaue ich mir mal an :)

Mach gern nochmal ein Uploader Update hab jetzt alles in die Datenbank gepackt mit den Keys.

doob187 commented 1 year ago

So pull läuft

drag0n141 commented 1 year ago

Ok top, wenn das bei dir läuft dann läuft das glaub ich bei jedem Problemlos :D

doob187 commented 1 year ago

Bis jetzt nur den Fehler

cat: '/system/uploader/logs/Zombie Land Saga - S01E09 - Though My Life May Have Ended Once By Some Twist of Fate I Have Risen, and If Song and Dance Are to Be My Fate, Then Carrying the Memories of My Comrades In My Heart As I Sally F... [tvdb-351953] [x264-Bluray-1080p AC3-2.0].mkv.txt': Filename too long
drag0n141 commented 1 year ago

Das liegt aber nicht an den Änderungen, das ist leider die Linux Limitation da ist tatsächlich einfach der Filename zu lang.

doob187 commented 1 year ago

Der knallt gut durch Keine Lücken im pull oder upload

drag0n141 commented 1 year ago

Also nochmal schneller?

doob187 commented 1 year ago

Ja das Geil ohne Lücken

Eins wrg zack nächste hängt schon im upload Fenster

doob187 commented 1 year ago

Ein Delay von ca 3 - 4 Sekunden zwischen im upload und fertig dann nächster

drag0n141 commented 1 year ago

Nice :D dann hat das Optimieren der SQLite Codes wenigstens geholfen :D Ja der Delay ist normal wegen den Checks, hatte es tatsächlich mal ohne die Sleeps dazwischen probiert das war aber wieder für die Datenbank zu schnell.

doob187 commented 1 year ago

Und was ist wenn du die checks Im Nullen Bereich machst

Statt 5sek kann man .5 schreiben wären 0.5 Sekunden

drag0n141 commented 1 year ago

Hatte ich tatsächlich auch probiert mit 2 Sekunden jeweils hat es sich als sehr gut rausgestellt, da gab es bisher keine Probleme. Und ist ja trotzdem echt schnell denke die paar Sekunden sollte man nicht riskieren :)

doob187 commented 1 year ago

Take a look at cat /proc/stat

grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'

.

Current CPU usage can be potentially calculated with:

awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' \
<(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat)

Man kann auch die sleeps Variable an die auslastung vom CPU hängen

doob187 commented 1 year ago

Wenn zb cpu load über 70-90 ist Was bedeutet das system ist mehr als am Limit

Dann soll er warten bis cpuload wieder bei 50 und drunter ist

Für Leute mit kleinen Server die wenig Leistung haben wäre es evtl gut

Dadurch würden die nicht immer am Limit laufen