Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement load tester prototype #363

Merged
merged 28 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions cmd/cli/loadtest/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt )
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package main

import (
"context"

"github.com/vdaas/vald/internal/info"
"github.com/vdaas/vald/internal/log"
"github.com/vdaas/vald/internal/runner"
"github.com/vdaas/vald/internal/safety"
"github.com/vdaas/vald/pkg/tools/cli/loadtest/config"
"github.com/vdaas/vald/pkg/tools/cli/loadtest/usecase"
)

const (
maxVersion = "v0.0.30"
minVersion = "v0.0.0"
name = "load test"
)

func main() {
if err := safety.RecoverFunc(func() error {
return runner.Do(
context.Background(),
runner.WithName(name),
runner.WithVersion(info.Version, maxVersion, minVersion),
runner.WithConfigLoader(func(path string) (interface{}, *config.GlobalConfig, error) {
cfg, err := config.NewConfig(path)
if err != nil {
return nil, nil, err
}
return cfg, &cfg.GlobalConfig, nil
}),
runner.WithDaemonInitializer(func(cfg interface{}) (runner.Runner, error) {
return usecase.New(cfg.(*config.Data))
}),
)
})(); err != nil {
log.Fatal(err)
return
}
}
76 changes: 76 additions & 0 deletions cmd/cli/loadtest/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

---
version: v0.0.0
time_zone: JST
logging:
logger: glg
level: debug
format: json
method: insert
dataset: fashion-mnist
concurrency: 100
addr: "localhost:8081"
client:
addrs: []
health_check_duration: 1s
backoff:
backoff_factor: 0
backoff_time_limit: ""
enable_error_log: false
initial_duration: ""
jitter_limit: ""
maximum_duration: ""
retry_count: 0
call_option:
max_recv_msg_size: 0
max_retry_rpc_buffer_size: 0
max_send_msg_size: 0
wait_for_ready: true
dial_option:
enable_backoff: false
initial_connection_window_size: 0
initial_window_size: 0
insecure: true
keep_alive:
permit_without_stream: false
time: ""
timeout: ""
max_backoff_delay: ""
max_msg_size: 0
read_buffer_size: 0
tcp:
dialer:
dual_stack_enabled: true
keep_alive: ""
timeout: ""
dns:
cache_enabled: false
cache_expiration: ""
refresh_duration: ""
tls:
ca: /path/to/ca
cert: /path/to/cert
enabled: false
key: /path/to/key
timeout: ""
write_buffer_size: 0
tls:
ca: /path/to/ca
cert: /path/to/cert
enabled: false
key: /path/to/key
Loading