scriptnull / badgeit

[WIP] Hassle-free badges for your READMEs.
MIT License
3 stars 1 forks source link

Post mortem analysis on remacs repo cloning #19

Closed scriptnull closed 7 years ago

scriptnull commented 7 years ago

Recently @argonlaser tried cloning https://github.com/Wilfred/remacs on the worker. This git repo is 250+ MB in size. ( Good job on doing thisπŸ… πŸŽ– )

After the cloning process starts, the following logs are found and the worker container stops. Also note that, during the cloning process, the CPU usage is very high and even SSH into the machine is being blocked by the absence of CPU availability, I guess.

Suspicion

I have following suspicions:

  1. Currently, worker clones the repo in default temp directory of the container. Does that mean, it's being cloned on the RAM. Maybe we need to use docker volumes and use that volume as a path to clone and see if this fixes the problem.
  2. Even though we might use volumes, the problem might still be unresolved, as we are not having enough RAM. If yes, we need to figure out which part of the cod e( may the external git lib) is using this much RAM and why it's exceeding 1GB.

Logs

2017/07/20 17:40:39 Booting Badgeit worker
2017/07/20 17:40:39 Setting up connection to badgeit queue
2017/07/20 17:40:39 Booted Badgeit Worker. To exit press CTRL+C
2017/07/20 17:40:39 Starting Task for message: {"callback":"https://b04ce0a2.ngrok.io/callback","download":"git","remote":"https://github.com/Wilfred/remacs"}
2017/07/20 17:40:39 Downloading the repository:  https://github.com/Wilfred/remacs
Counting objects: 773877, done.
Compressing objects: 100% (17/17), done.
Total 773877 (delta 4), reused 5 (delta 0), pack-reused 773860
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x83ad1d, 0x16)
    /usr/local/go/src/runtime/panic.go:596 +0x95
runtime.sysMap(0xc44a380000, 0x100000, 0x456c00, 0xa47bb8)
    /usr/local/go/src/runtime/mem_linux.go:216 +0x1d0
runtime.(*mheap).sysAlloc(0xa2ef20, 0x100000, 0x7fffb5dddc08)
    /usr/local/go/src/runtime/malloc.go:428 +0x374
runtime.(*mheap).grow(0xa2ef20, 0x2f, 0x0)
    /usr/local/go/src/runtime/mheap.go:774 +0x62
runtime.(*mheap).allocSpanLocked(0xa2ef20, 0x2f, 0x7ff2d0d315b0)
    /usr/local/go/src/runtime/mheap.go:678 +0x44f
runtime.(*mheap).alloc_m(0xa2ef20, 0x2f, 0x100000000, 0x0)
    /usr/local/go/src/runtime/mheap.go:562 +0xe2
runtime.(*mheap).alloc.func1()
    /usr/local/go/src/runtime/mheap.go:627 +0x4b
runtime.systemstack(0x7fffb5dddd00)
    /usr/local/go/src/runtime/asm_amd64.s:343 +0xab
runtime.(*mheap).alloc(0xa2ef20, 0x2f, 0x100000000, 0x0)
    /usr/local/go/src/runtime/mheap.go:628 +0xa0
runtime.largeAlloc(0x5e000, 0x451400, 0xc44a322000)
    /usr/local/go/src/runtime/malloc.go:795 +0x93
runtime.mallocgc.func1()
    /usr/local/go/src/runtime/malloc.go:690 +0x3e
runtime.systemstack(0xa2a400)
    /usr/local/go/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
    /usr/local/go/src/runtime/proc.go:1132

goroutine 29 [running]:
runtime.systemstack_switch()
    /usr/local/go/src/runtime/asm_amd64.s:281 fp=0xc4384fa0f8 sp=0xc4384fa0f0
runtime.mallocgc(0x5e000, 0x0, 0x2f500, 0xc44a322000)
    /usr/local/go/src/runtime/malloc.go:691 +0x930 fp=0xc4384fa198 sp=0xc4384fa0f8
runtime.growslice(0x797b40, 0xc44a322000, 0x3f5b4, 0x4a000, 0x4f5b4, 0xc44733bc32, 0x12, 0x1ce)
    /usr/local/go/src/runtime/slice.go:140 +0x23e fp=0xc4384fa220 sp=0xc4384fa198
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.PatchDelta(0xc44a224000, 0x6ff02, 0x7fe00, 0xc44733bc2f, 0x15, 0x1d1, 0x0, 0x9f6fa0, 0xc4202b9200)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/patch_delta.go:70 +0x50f fp=0xc4384fa2e0 sp=0xc4384fa220
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.ApplyDelta(0x9f6fa0, 0xc4202b9000, 0x9f6fa0, 0xc4202b9200, 0xc44733bc00, 0x44, 0x200, 0xa46390, 0x7fefc0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/patch_delta.go:33 +0x149 fp=0xc4384fa370 sp=0xc4384fa2e0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b9000, 0x7f05a4b, 0xc420190ac0, 0xc4384fa480, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:382 +0x202 fp=0xc4384fa420 sp=0xc4384fa370
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8f40, 0x0, 0x0, 0xc4384fa558, 0xc420126870)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fa518 sp=0xc4384fa420
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x7f7199c, 0xc4384fa580)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fa558 sp=0xc4384fa518
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x7f7191a, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fa5a0 sp=0xc4384fa558
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x7f7191a, 0x306c6190138d76e5, 0xc476230eb6, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fa608 sp=0xc4384fa5a0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b8e80, 0x7f7191a, 0xc420190ac0, 0xc4384fa728, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fa6b8 sp=0xc4384fa608
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8dc0, 0x0, 0x0, 0xc4384fa7f0, 0xc420126b90)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fa7b0 sp=0xc4384fa6b8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x7f719c4, 0xc4384fa818)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fa7f0 sp=0xc4384fa7b0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x7f71967, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fa838 sp=0xc4384fa7f0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x7f71967, 0x2dc2d03fdb7ab6b7, 0xc4e9bdb259, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fa8a0 sp=0xc4384fa838
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b8d00, 0x7f71967, 0xc420190ac0, 0xc4384fa9c0, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fa950 sp=0xc4384fa8a0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8c40, 0x0, 0x0, 0xc4384faa88, 0xc420126a50)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384faa48 sp=0xc4384fa950
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x7f719f0, 0xc4384faab0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384faa88 sp=0xc4384faa48
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x7f7199c, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384faad0 sp=0xc4384faa88
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x7f7199c, 0x76db9c29499f3e0, 0xc45e4e5dd0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fab38 sp=0xc4384faad0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b8b40, 0x7f7199c, 0xc420190ac0, 0xc4384fac58, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fabe8 sp=0xc4384fab38
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8ac0, 0x0, 0x0, 0xc4384fad20, 0xc420126aa0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384face0 sp=0xc4384fabe8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x80037f5, 0xc4384fad48)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fad20 sp=0xc4384face0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x7f719c4, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fad68 sp=0xc4384fad20
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x7f719c4, 0x5a56886535fd5853, 0xc42483c7c4, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fadd0 sp=0xc4384fad68
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b8a40, 0x7f719c4, 0xc420190ac0, 0xc4384faee0, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fae80 sp=0xc4384fadd0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8840, 0x0, 0x0, 0xc4384fafb8, 0xc420126af0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384faf78 sp=0xc4384fae80
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x806d500, 0xc4384fafe0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fafb8 sp=0xc4384faf78
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x80037ca, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fb000 sp=0xc4384fafb8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x80037ca, 0xad7501e8e37a3158, 0xc45b4fa3a9, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fb068 sp=0xc4384fb000
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b8780, 0x80037ca, 0xc420190ac0, 0xc4384fb178, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fb118 sp=0xc4384fb068
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8680, 0x0, 0x0, 0xc4384fb250, 0xc420126190)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fb210 sp=0xc4384fb118
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x806dd43, 0xc4384fb278)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fb250 sp=0xc4384fb210
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x806d4d5, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fb298 sp=0xc4384fb250
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x806d4d5, 0xafbafd7427892609, 0xc4ff3d2619, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fb300 sp=0xc4384fb298
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b84c0, 0x806d4d5, 0xc420190ac0, 0xc4384fb410, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fb3b0 sp=0xc4384fb300
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b83c0, 0x0, 0x0, 0xc4384fb4e8, 0xc4201261e0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fb4a8 sp=0xc4384fb3b0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x80d0591, 0xc4384fb510)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fb4e8 sp=0xc4384fb4a8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x806dd1a, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fb530 sp=0xc4384fb4e8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x806dd1a, 0x67fe71335b6f91d6, 0xc47251badf, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fb598 sp=0xc4384fb530
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4202b81c0, 0x806dd1a, 0xc420190ac0, 0xc4384fb6a8, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fb648 sp=0xc4384fb598
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4202b8000, 0x0, 0x0, 0xc4384fb780, 0xc420126140)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fb740 sp=0xc4384fb648
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x80d40f9, 0xc4384fb7a8)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fb780 sp=0xc4384fb740
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x80d0560, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fb7c8 sp=0xc4384fb780
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x80d0560, 0xaf5dff5c42595ce0, 0xc422270ab6, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fb830 sp=0xc4384fb7c8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4377e9fc0, 0x80d0560, 0xc420190ac0, 0xc4384fb940, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fb8e0 sp=0xc4384fb830
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4377e9f80, 0x0, 0x0, 0xc4384fba18, 0xc42004dc20)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fb9d8 sp=0xc4384fb8e0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x8490c0, 0xc4384fbf60, 0x81277ed, 0xc4384fba40)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fba18 sp=0xc4384fb9d8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObjectAt(0xc4384fbf60, 0x80d40d0, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:325 +0xd1 fp=0xc4384fba60 sp=0xc4384fba18
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).recallByOffset(0xc4384fbf60, 0x80d40d0, 0x9b992ea285473a50, 0xc45255b413, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:399 +0x124 fp=0xc4384fbac8 sp=0xc4384fba60
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillOFSDeltaObjectContent(0xc4384fbf60, 0x9f6fa0, 0xc4377e9f40, 0x80d40d0, 0xc420190ac0, 0xc4384fbbd8, 0x1)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:375 +0x2aa fp=0xc4384fbb78 sp=0xc4384fbac8
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4384fbf60, 0xc4377e9f00, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:279 +0x3d6 fp=0xc4384fbc70 sp=0xc4384fbb78
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4384fbf60, 0x9f6fa0, 0xc4377e9e80, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:214 +0x66 fp=0xc4384fbcb0 sp=0xc4384fbc70
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeObjects(0xc4384fbf60, 0xbcef5, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:155 +0x40 fp=0xc4384fbcf0 sp=0xc4384fbcb0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).doDecode(0xc420033f60, 0x8490b8, 0xc420033f60)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:145 +0x103 fp=0xc4384fbd38 sp=0xc4384fbcf0
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).Decode(0xc4384fbf60, 0x0, 0x0, 0xc400000000, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:129 +0xa1 fp=0xc4384fbd90 sp=0xc4384fbd38
gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit.(*PackWriter).buildIndex(0xc4200eca00)
    /go/src/gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit/writers.go:64 +0xc5 fp=0xc4384fbfd8 sp=0xc4384fbd90
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4384fbfe0 sp=0xc4384fbfd8
created by gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit.newPackWrite
    /go/src/gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit/writers.go:52 +0x3b5

goroutine 1 [chan receive, 18 minutes]:
main.main()
    /go/src/github.com/scriptnull/badgeit/worker/main.go:75 +0x62a

goroutine 17 [syscall, 18 minutes, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 10 [chan receive, 18 minutes]:
gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit.(*PackWriter).Close(0xc4200eca00, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit/writers.go:113 +0xbf
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.UpdateObjectStorage(0x7ff2d0db7fc8, 0xc42004d720, 0x9ee420, 0xc42004cf50, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/common.go:34 +0x173
gopkg.in/src-d/go-git%2ev4.(*Remote).fetchPack(0xc420106940, 0xc4200457a8, 0x9f3420, 0xc42000e1a0, 0xc4203e0840, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/remote.go:249 +0x2d3
gopkg.in/src-d/go-git%2ev4.(*Remote).fetch(0xc420106940, 0xc4200457a8, 0x0, 0x0, 0x0, 0x0)
    /go/src/gopkg.in/src-d/go-git.v4/remote.go:184 +0x585
gopkg.in/src-d/go-git%2ev4.(*Repository).clone(0xc4200f6de0, 0xc420045890, 0x4e9500, 0xc4200f6de0)
    /go/src/gopkg.in/src-d/go-git.v4/repository.go:395 +0x1b8
gopkg.in/src-d/go-git%2ev4.PlainClone(0xc420106160, 0x12, 0xbc4cc7f004b6500, 0xc420045890, 0xc4200ba180, 0x3f, 0x53)
    /go/src/gopkg.in/src-d/go-git.v4/repository.go:289 +0x8b
github.com/scriptnull/badgeit/worker/downloader.(*GitDownloader).Download(0xc4200f67b0, 0x2, 0x2)
    /go/src/github.com/scriptnull/badgeit/worker/downloader/download_git.go:17 +0xb4
main.executeTask(0xc42004bb90, 0x6f, 0x70)
    /go/src/github.com/scriptnull/badgeit/worker/main.go:127 +0x51a
main.main.func1(0xc420016b40)
    /go/src/github.com/scriptnull/badgeit/worker/main.go:68 +0x1cc
created by main.main
    /go/src/github.com/scriptnull/badgeit/worker/main.go:72 +0x5d0

goroutine 19 [select, 18 minutes]:
net/http.(*persistConn).readLoop(0xc420071d40)
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:1117 +0xa35

goroutine 20 [select, 18 minutes]:
net/http.(*persistConn).writeLoop(0xc420071d40)
    /usr/local/go/src/net/http/transport.go:1704 +0x43a
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a
exit status 2
argonlaser commented 7 years ago

Good analysis. We must have a caching layer in FRONT or API so as to minimize the cloning that would help a lot to avoid cloning big repositories.

scriptnull commented 7 years ago

SSHed into the box and exec bash on docker and git clone inside the docker command results in a usual memory usage

It started with screen shot 2017-08-06 at 8 12 58 pm

It went all the way up to screen shot 2017-08-06 at 8 13 11 pm

When I used the website to clone remacs, memory and CPU usage hikes to screen shot 2017-08-06 at 8 10 57 pm

Investigating more.

scriptnull commented 7 years ago

As I suspected, it was a discrepancy caused by the git clone library. Removed the dependency and used os/exec with git seem to solve the problem.

Now the server is able to clone multiple remacs at the same time.

scriptnull commented 7 years ago

hmm the initial clone went well. But I made the worker size to 4 and seems like we are missing something.

But, for now it should be ok. I think, i will try some kind of limiting like docker cpu limit, memory limit etc.

scriptnull commented 7 years ago

Configuration plan 1

Service Qty Memory Cpu
rabbit 1 150m 1
api 1 50m 1
front 1 200m 2
worker 2 200m 3

Results: Worker performance results

Repo number Size of Repo Start time End time
remacs 1 ~250m 2:24 2:33
remacs 2 ~250m 2:24 2:33

go-wrk badgeit.today alone

 scriptnull πŸ“‚  ~ ⚑️ : go-wrk -t 2 http://badgeit.today
==========================BENCHMARK==========================
URL:                http://badgeit.today

Used Connections:       100
Used Threads:           2
Total number of calls:      1000

===========================TIMINGS===========================
Total time passed:      12.13s
Avg time per request:       1095.28ms
Requests per second:        82.43
Median time per request:    905.13ms
99th percentile time:       2464.57ms
Slowest time for request:   2469.00ms

=============================DATA=============================
Total response body sizes:      2470000
Avg response body per request:      2470.00ms
Transfer rate per second:       203592.69 Byte/s (0.20 MByte/s)
==========================RESPONSES==========================
20X Responses:      1000    (100.00%)
30X Responses:      0   (0.00%)
40X Responses:      0   (0.00%)
50X Responses:      0   (0.00%)
Errors:         0   (0.00%)

 scriptnull πŸ“‚  ~ ⚑️  go-wrk -t 3 http://badgeit.today
==========================BENCHMARK==========================
URL:                http://badgeit.today

Used Connections:       100
Used Threads:           3
Total number of calls:      1000

===========================TIMINGS===========================
Total time passed:      10.18s
Avg time per request:       909.04ms
Requests per second:        98.25
Median time per request:    875.53ms
99th percentile time:       1508.94ms
Slowest time for request:   1548.00ms

=============================DATA=============================
Total response body sizes:      2470000
Avg response body per request:      2470.00ms
Transfer rate per second:       242668.35 Byte/s (0.24 MByte/s)
==========================RESPONSES==========================
20X Responses:      1000    (100.00%)
30X Responses:      0   (0.00%)
40X Responses:      0   (0.00%)
50X Responses:      0   (0.00%)
Errors:         0   (0.00%)

go-wrk badgeit.today + all workers are working

 scriptnull πŸ“‚  ~ ⚑️ : go-wrk -t 2 http://badgeit.today
==========================BENCHMARK==========================
URL:                http://badgeit.today

Used Connections:       100
Used Threads:           32
Total number of calls:      1000

===========================TIMINGS===========================
Total time passed:      12.69s
Avg time per request:       1141.27ms
Requests per second:        78.82
Median time per request:    1155.23ms
99th percentile time:       1786.83ms
Slowest time for request:   2285.00ms

=============================DATA=============================
Total response body sizes:      2470000
Avg response body per request:      2470.00ms
Transfer rate per second:       194688.81 Byte/s (0.19 MByte/s)
==========================RESPONSES==========================
20X Responses:      1000    (100.00%)
30X Responses:      0   (0.00%)
40X Responses:      0   (0.00%)
50X Responses:      0   (0.00%)
Errors:         0   (0.00%)
 scriptnull πŸ“‚  ~ ⚑️  go-wrk -t 3 http://badgeit.today
==========================BENCHMARK==========================
URL:                http://badgeit.today

Used Connections:       100
Used Threads:           3
Total number of calls:      1000

===========================TIMINGS===========================
Total time passed:      9.77s
Avg time per request:       874.93ms
Requests per second:        102.30
Median time per request:    846.44ms
99th percentile time:       1406.76ms
Slowest time for request:   1716.00ms

=============================DATA=============================
Total response body sizes:      2470000
Avg response body per request:      2470.00ms
Transfer rate per second:       252691.78 Byte/s (0.25 MByte/s)
==========================RESPONSES==========================
20X Responses:      1000    (100.00%)
30X Responses:      0   (0.00%)
40X Responses:      0   (0.00%)
50X Responses:      0   (0.00%)
Errors:         0   (0.00%)
scriptnull commented 7 years ago

Things are pretty stable now. At least we are in a position where, our machine is not going down. The above configuration suits us and if some error happens, it should probably stop that container with error logs, as I have set memory, cpu-period, cpu-quota options in docker.