Merge pull request #2091 from crosbymichael/shim-size
Shim optimizations for size and cpu
This commit is contained in:
commit
549ec7b9dd
@ -60,7 +60,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
debug.SetGCPercent(10)
|
debug.SetGCPercent(40)
|
||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(30 * time.Second) {
|
for range time.Tick(30 * time.Second) {
|
||||||
debug.FreeOSMemory()
|
debug.FreeOSMemory()
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
package proc
|
package proc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
containerd_types "github.com/containerd/containerd/api/types"
|
|
||||||
google_protobuf "github.com/gogo/protobuf/types"
|
google_protobuf "github.com/gogo/protobuf/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Mount holds filesystem mount configuration
|
||||||
|
type Mount struct {
|
||||||
|
Type string
|
||||||
|
Source string
|
||||||
|
Target string
|
||||||
|
Options []string
|
||||||
|
}
|
||||||
|
|
||||||
// CreateConfig hold task creation configuration
|
// CreateConfig hold task creation configuration
|
||||||
type CreateConfig struct {
|
type CreateConfig struct {
|
||||||
ID string
|
ID string
|
||||||
Bundle string
|
Bundle string
|
||||||
Runtime string
|
Runtime string
|
||||||
Rootfs []*containerd_types.Mount
|
Rootfs []Mount
|
||||||
Terminal bool
|
Terminal bool
|
||||||
Stdin string
|
Stdin string
|
||||||
Stdout string
|
Stdout string
|
||||||
|
@ -95,6 +95,16 @@ type Service struct {
|
|||||||
func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) {
|
func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
|
|
||||||
|
var mounts []proc.Mount
|
||||||
|
for _, m := range r.Rootfs {
|
||||||
|
mounts = append(mounts, proc.Mount{
|
||||||
|
Type: m.Type,
|
||||||
|
Source: m.Source,
|
||||||
|
Target: m.Target,
|
||||||
|
Options: m.Options,
|
||||||
|
})
|
||||||
|
}
|
||||||
process, err := proc.New(
|
process, err := proc.New(
|
||||||
ctx,
|
ctx,
|
||||||
s.config.Path,
|
s.config.Path,
|
||||||
@ -108,7 +118,7 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh
|
|||||||
ID: r.ID,
|
ID: r.ID,
|
||||||
Bundle: r.Bundle,
|
Bundle: r.Bundle,
|
||||||
Runtime: r.Runtime,
|
Runtime: r.Runtime,
|
||||||
Rootfs: r.Rootfs,
|
Rootfs: mounts,
|
||||||
Terminal: r.Terminal,
|
Terminal: r.Terminal,
|
||||||
Stdin: r.Stdin,
|
Stdin: r.Stdin,
|
||||||
Stdout: r.Stdout,
|
Stdout: r.Stdout,
|
||||||
|
12
log/grpc.go
12
log/grpc.go
@ -1,12 +0,0 @@
|
|||||||
package log
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"google.golang.org/grpc/grpclog"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags))
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user