Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8c0b1c7d
Commit
8c0b1c7d
authored
Jun 03, 2015
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8809 from rrati/performance-gathering-7572
Performance gathering 7572
parents
a72be466
a248d0cc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
10 deletions
+125
-10
density.go
test/e2e/density.go
+27
-7
fifo_queue.go
test/e2e/fifo_queue.go
+75
-0
load.go
test/e2e/load.go
+14
-2
scale.go
test/e2e/scale.go
+9
-1
util.go
test/e2e/util.go
+0
-0
No files found.
test/e2e/density.go
View file @
8c0b1c7d
...
@@ -19,6 +19,7 @@ package e2e
...
@@ -19,6 +19,7 @@ package e2e
import
(
import
(
"fmt"
"fmt"
"math"
"math"
"os"
"strconv"
"strconv"
"time"
"time"
...
@@ -45,6 +46,7 @@ var _ = Describe("Density", func() {
...
@@ -45,6 +46,7 @@ var _ = Describe("Density", func() {
var
minionCount
int
var
minionCount
int
var
RCName
string
var
RCName
string
var
ns
string
var
ns
string
var
uuid
string
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
var
err
error
var
err
error
...
@@ -57,6 +59,9 @@ var _ = Describe("Density", func() {
...
@@ -57,6 +59,9 @@ var _ = Describe("Density", func() {
nsForTesting
,
err
:=
createTestingNS
(
"density"
,
c
)
nsForTesting
,
err
:=
createTestingNS
(
"density"
,
c
)
ns
=
nsForTesting
.
Name
ns
=
nsForTesting
.
Name
expectNoError
(
err
)
expectNoError
(
err
)
uuid
=
string
(
util
.
NewUUID
())
expectNoError
(
os
.
Mkdir
(
uuid
,
0777
))
expectNoError
(
writePerfData
(
c
,
uuid
,
"before"
))
})
})
AfterEach
(
func
()
{
AfterEach
(
func
()
{
...
@@ -76,6 +81,8 @@ var _ = Describe("Density", func() {
...
@@ -76,6 +81,8 @@ var _ = Describe("Density", func() {
Failf
(
"Couldn't delete ns %s"
,
err
)
Failf
(
"Couldn't delete ns %s"
,
err
)
}
}
expectNoError
(
writePerfData
(
c
,
uuid
,
"after"
))
// Verify latency metrics
// Verify latency metrics
// TODO: Update threshold to 1s once we reach this goal
// TODO: Update threshold to 1s once we reach this goal
// TODO: We should reset metrics before the test. Currently previous tests influence latency metrics.
// TODO: We should reset metrics before the test. Currently previous tests influence latency metrics.
...
@@ -89,16 +96,18 @@ var _ = Describe("Density", func() {
...
@@ -89,16 +96,18 @@ var _ = Describe("Density", func() {
type
Density
struct
{
type
Density
struct
{
skip
bool
skip
bool
podsPerMinion
int
podsPerMinion
int
/* Controls how often the apiserver is polled for pods */
interval
int
}
}
densityTests
:=
[]
Density
{
densityTests
:=
[]
Density
{
// This test should always run, even if larger densities are skipped.
// This test should always run, even if larger densities are skipped.
{
podsPerMinion
:
3
,
skip
:
false
},
{
podsPerMinion
:
3
,
skip
:
false
,
interval
:
10
},
{
podsPerMinion
:
30
,
skip
:
false
},
{
podsPerMinion
:
30
,
skip
:
false
,
interval
:
10
},
// More than 30 pods per node is outside our v1.0 goals.
// More than 30 pods per node is outside our v1.0 goals.
// We might want to enable those tests in the future.
// We might want to enable those tests in the future.
{
podsPerMinion
:
50
,
skip
:
true
},
{
podsPerMinion
:
50
,
skip
:
true
,
interval
:
10
},
{
podsPerMinion
:
100
,
skip
:
true
},
{
podsPerMinion
:
100
,
skip
:
true
,
interval
:
1
},
}
}
for
_
,
testArg
:=
range
densityTests
{
for
_
,
testArg
:=
range
densityTests
{
...
@@ -112,8 +121,19 @@ var _ = Describe("Density", func() {
...
@@ -112,8 +121,19 @@ var _ = Describe("Density", func() {
itArg
:=
testArg
itArg
:=
testArg
It
(
name
,
func
()
{
It
(
name
,
func
()
{
totalPods
:=
itArg
.
podsPerMinion
*
minionCount
totalPods
:=
itArg
.
podsPerMinion
*
minionCount
nameStr
:=
strconv
.
Itoa
(
totalPods
)
+
"-"
+
string
(
util
.
NewUUID
())
RCName
=
"density"
+
strconv
.
Itoa
(
totalPods
)
+
"-"
+
uuid
RCName
=
"my-hostname-density"
+
nameStr
fileHndl
,
err
:=
os
.
Create
(
fmt
.
Sprintf
(
"%s/pod_states.csv"
,
uuid
))
expectNoError
(
err
)
defer
fileHndl
.
Close
()
config
:=
RCConfig
{
Client
:
c
,
Image
:
"gcr.io/google_containers/pause:go"
,
Name
:
RCName
,
Namespace
:
ns
,
PollInterval
:
itArg
.
interval
,
PodStatusFile
:
fileHndl
,
Replicas
:
totalPods
,
}
// Create a listener for events.
// Create a listener for events.
events
:=
make
([](
*
api
.
Event
),
0
)
events
:=
make
([](
*
api
.
Event
),
0
)
...
@@ -139,7 +159,7 @@ var _ = Describe("Density", func() {
...
@@ -139,7 +159,7 @@ var _ = Describe("Density", func() {
// Start the replication controller.
// Start the replication controller.
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
expectNoError
(
RunRC
(
c
,
RCName
,
ns
,
"gcr.io/google_containers/pause:go"
,
totalPods
))
expectNoError
(
RunRC
(
c
onfig
))
e2eStartupTime
:=
time
.
Now
()
.
Sub
(
startTime
)
e2eStartupTime
:=
time
.
Now
()
.
Sub
(
startTime
)
Logf
(
"E2E startup time for %d pods: %v"
,
totalPods
,
e2eStartupTime
)
Logf
(
"E2E startup time for %d pods: %v"
,
totalPods
,
e2eStartupTime
)
...
...
test/e2e/fifo_queue.go
0 → 100644
View file @
8c0b1c7d
/*
Copyright 2014 The Kubernetes Authors All rights reserved.
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
http://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
e2e
import
(
"sync"
"time"
)
type
QueueItem
struct
{
createTime
string
value
interface
{}
}
type
QueueItems
struct
{
pos
int
mutex
*
sync
.
Mutex
list
[]
QueueItem
}
type
FifoQueue
QueueItems
func
(
fq
*
FifoQueue
)
Push
(
elem
interface
{})
{
fq
.
mutex
.
Lock
()
fq
.
list
=
append
(
fq
.
list
,
QueueItem
{
time
.
Now
()
.
String
(),
elem
})
fq
.
mutex
.
Unlock
()
}
func
(
fq
*
FifoQueue
)
Pop
()
QueueItem
{
fq
.
mutex
.
Lock
()
var
val
QueueItem
if
len
(
fq
.
list
)
-
1
>=
fq
.
pos
{
val
=
fq
.
list
[
fq
.
pos
]
fq
.
pos
++
}
fq
.
mutex
.
Unlock
()
return
val
}
func
(
fq
FifoQueue
)
Len
()
int
{
return
len
(
fq
.
list
[
fq
.
pos
:
])
}
func
(
fq
*
FifoQueue
)
First
()
QueueItem
{
return
fq
.
list
[
fq
.
pos
]
}
func
(
fq
*
FifoQueue
)
Last
()
QueueItem
{
return
fq
.
list
[
len
(
fq
.
list
)
-
1
]
}
func
(
fq
*
FifoQueue
)
Reset
()
{
fq
.
pos
=
0
}
func
newFifoQueue
()
*
FifoQueue
{
tmp
:=
new
(
FifoQueue
)
tmp
.
mutex
=
&
sync
.
Mutex
{}
tmp
.
pos
=
0
return
tmp
}
test/e2e/load.go
View file @
8c0b1c7d
...
@@ -149,7 +149,13 @@ func playWithRC(c *client.Client, wg *sync.WaitGroup, ns, name string, size int)
...
@@ -149,7 +149,13 @@ func playWithRC(c *client.Client, wg *sync.WaitGroup, ns, name string, size int)
// Once every 1-2 minutes perform scale of RC.
// Once every 1-2 minutes perform scale of RC.
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
simulationTime
;
time
.
Sleep
(
time
.
Duration
(
60
+
rand
.
Intn
(
60
))
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
simulationTime
;
time
.
Sleep
(
time
.
Duration
(
60
+
rand
.
Intn
(
60
))
*
time
.
Second
)
{
if
!
rcExist
{
if
!
rcExist
{
expectNoError
(
RunRC
(
c
,
name
,
ns
,
image
,
size
),
fmt
.
Sprintf
(
"creating rc %s in namespace %s"
,
name
,
ns
))
config
:=
RCConfig
{
Client
:
c
,
Name
:
name
,
Namespace
:
ns
,
Image
:
image
,
Replicas
:
size
,
}
expectNoError
(
RunRC
(
config
),
fmt
.
Sprintf
(
"creating rc %s in namespace %s"
,
name
,
ns
))
rcExist
=
true
rcExist
=
true
}
}
// Scale RC to a random size between 0.5x and 1.5x of the original size.
// Scale RC to a random size between 0.5x and 1.5x of the original size.
...
@@ -187,7 +193,13 @@ func createRCGroup(c *client.Client, ns, groupName string, size, count, batchSiz
...
@@ -187,7 +193,13 @@ func createRCGroup(c *client.Client, ns, groupName string, size, count, batchSiz
defer
GinkgoRecover
()
defer
GinkgoRecover
()
defer
wg
.
Done
()
defer
wg
.
Done
()
name
:=
groupName
+
"-"
+
strconv
.
Itoa
(
i
)
name
:=
groupName
+
"-"
+
strconv
.
Itoa
(
i
)
expectNoError
(
RunRC
(
c
,
name
,
ns
,
image
,
size
),
fmt
.
Sprintf
(
"creating rc %s in namespace %s for the first time"
,
name
,
ns
))
config
:=
RCConfig
{
Client
:
c
,
Name
:
name
,
Namespace
:
ns
,
Image
:
image
,
Replicas
:
size
,
}
expectNoError
(
RunRC
(
config
),
fmt
.
Sprintf
(
"creating rc %s in namespace %s for the first time"
,
name
,
ns
))
}(
i
)
}(
i
)
}
}
wg
.
Wait
()
wg
.
Wait
()
...
...
test/e2e/scale.go
View file @
8c0b1c7d
...
@@ -107,7 +107,15 @@ var _ = Describe("Scale", func() {
...
@@ -107,7 +107,15 @@ var _ = Describe("Scale", func() {
for
i
:=
0
;
i
<
itArg
.
rcsPerThread
;
i
++
{
for
i
:=
0
;
i
<
itArg
.
rcsPerThread
;
i
++
{
name
:=
"my-short-lived-pod"
+
string
(
util
.
NewUUID
())
name
:=
"my-short-lived-pod"
+
string
(
util
.
NewUUID
())
n
:=
itArg
.
podsPerMinion
*
minionCount
n
:=
itArg
.
podsPerMinion
*
minionCount
expectNoError
(
RunRC
(
c
,
name
,
ns
,
"gcr.io/google_containers/pause:go"
,
n
))
config
:=
RCConfig
{
Client
:
c
,
Name
:
name
,
Namespace
:
ns
,
Image
:
"gcr.io/google_containers/pause:go"
,
Replicas
:
n
,
}
expectNoError
(
RunRC
(
config
))
podsLaunched
+=
n
podsLaunched
+=
n
Logf
(
"Launched %v pods so far..."
,
podsLaunched
)
Logf
(
"Launched %v pods so far..."
,
podsLaunched
)
err
:=
DeleteRC
(
c
,
ns
,
name
)
err
:=
DeleteRC
(
c
,
ns
,
name
)
...
...
test/e2e/util.go
View file @
8c0b1c7d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment