Avoid buffering to tempfile when pushing with V2
The practice of buffering to a tempfile during a pushing contributes massively to slow V2 push performance perception. The protocol was actually designed to avoid precalculation, supporting cut-through data push. This means we can assemble the layer, calculate its digest and push to the remote endpoint, all at the same time. This should increase performance massively on systems with slow disks or IO bottlenecks. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
066a0b3b75
commit
fd5edd5df3
2 changed files with 8 additions and 2 deletions
|
@ -67,8 +67,14 @@ func (p *JSONProgress) String() string {
|
||||||
}
|
}
|
||||||
pbBox = fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces))
|
pbBox = fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces))
|
||||||
}
|
}
|
||||||
|
|
||||||
numbersBox = fmt.Sprintf("%8v/%v", current, total)
|
numbersBox = fmt.Sprintf("%8v/%v", current, total)
|
||||||
|
|
||||||
|
if p.Current > p.Total {
|
||||||
|
// remove total display if the reported current is wonky.
|
||||||
|
numbersBox = fmt.Sprintf("%8v", current)
|
||||||
|
}
|
||||||
|
|
||||||
if p.Current > 0 && p.Start > 0 && percentage < 50 {
|
if p.Current > 0 && p.Start > 0 && percentage < 50 {
|
||||||
fromStart := time.Now().UTC().Sub(time.Unix(p.Start, 0))
|
fromStart := time.Now().UTC().Sub(time.Unix(p.Start, 0))
|
||||||
perEntry := fromStart / time.Duration(p.Current)
|
perEntry := fromStart / time.Duration(p.Current)
|
||||||
|
|
|
@ -3,12 +3,12 @@ package jsonmessage
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
"github.com/docker/docker/pkg/timeutils"
|
"github.com/docker/docker/pkg/timeutils"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestError(t *testing.T) {
|
func TestError(t *testing.T) {
|
||||||
|
@ -45,7 +45,7 @@ func TestProgress(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this number can't be negative gh#7136
|
// this number can't be negative gh#7136
|
||||||
expected = "[==================================================>] 50 B/40 B"
|
expected = "[==================================================>] 50 B"
|
||||||
jp5 := JSONProgress{Current: 50, Total: 40}
|
jp5 := JSONProgress{Current: 50, Total: 40}
|
||||||
if jp5.String() != expected {
|
if jp5.String() != expected {
|
||||||
t.Fatalf("Expected %q, got %q", expected, jp5.String())
|
t.Fatalf("Expected %q, got %q", expected, jp5.String())
|
||||||
|
|
Loading…
Reference in a new issue