-
Notifications
You must be signed in to change notification settings - Fork 521
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
Storage flag #1360
Storage flag #1360
Conversation
@@ -22,6 +22,25 @@ | |||
|
|||
As other cloud providers deliver a managed MySQL service, we will add it here. | |||
|
|||
To make this benchmark run for GCP: | |||
To run this benchmark for GCP if is required to install a non-default gcloud |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "if"
specify reasons why it's required to install a non-default gcloud component (because ...), also specify the time/date of this requirement ("As of May 2017")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the reasons are specified below, properly better to pull that up to here for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in new commit.
@@ -61,6 +80,7 @@ | |||
flags.DEFINE_integer('sysbench_report_interval', 2, | |||
'The interval, in seconds, we ask sysbench to report ' | |||
'results.') | |||
flags.DEFINE_integer('storage_size', 3400, 'Storage size for SQL instance.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify the units for storage size, e.g., in GB
Also, does the default has to be this large? It has cost consequence. Probably we should specify a smaller default for those who just want to try out the benchmarks. 100?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in new commit.
@@ -668,13 +680,23 @@ def Prepare(self, vm): | |||
logging.info('Preparing MySQL Service benchmarks for Google Cloud SQL.') | |||
|
|||
vm.db_instance_name = 'pkb%s' % FLAGS.run_uri | |||
storage_size = self._validate_size(FLAGS.storage_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a simple validation for RDS too? (for completeness).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in new commit.
|
||
GCP supports storage sizes from 0 to 64TB currently. | ||
""" | ||
if size < 0 or size > 64000: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 is not supported either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in new commit.
""" | ||
if size < 0 or size > 64000: | ||
size = 3334 | ||
return size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If size is invalid we should throw an exception and fail the benchmark run. We can't silently change user's input to a default value....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good as first iteration. There are a few minor comments, please take a look.
@@ -558,6 +572,21 @@ def Prepare(self, vm): | |||
logging.info('Successfully created an RDS DB instance. Address is %s', | |||
vm.db_instance_address) | |||
logging.info('Complete output is:\n %s', response) | |||
|
|||
def _validate_size(self, size): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, PKB's style is CamelCase for function names, so please change it to be consistent with the rest of the file. You can leave the underscore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
@@ -558,6 +572,21 @@ def Prepare(self, vm): | |||
logging.info('Successfully created an RDS DB instance. Address is %s', | |||
vm.db_instance_address) | |||
logging.info('Complete output is:\n %s', response) | |||
|
|||
def _validate_size(self, size): | |||
"""Validates flag for storage size, throws exception if invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to "Validate flag for storage size and throw exception if invalid." The style guide requests that summary doc strings are written as a command, not a description. Also, move "AWS supports storage sizes from 1GB to 16TB currently." Up so that it is one line below the summary and above the args and returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
@@ -22,11 +22,31 @@ | |||
|
|||
As other cloud providers deliver a managed MySQL service, we will add it here. | |||
|
|||
As of May 2017 to make this benchmark run for GCP you must install the | |||
gcloud beta component. This is necessary because creating a SQL instance with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/SQL/"Cloud SQL"/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
AWS supports storage sizes from 1GB to 16TB currently. | ||
""" | ||
if size < 1 or size > 16000: | ||
sys.exit('Storage size flag given is not valid. Must be between ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of doing sys.exit() can you throw an exception instead? (follow the example of error handling logic in other places of this code).
By throwing exception here, the parent classes of PKB may decide to catch those and initiate a cleanup if necessary, however, doing sys.exit() would void all that possibility.
(As FYI: Currently PKB doesn't usually do cleanup upon benchmark failure, so if a user sees an exception here, they will need to call pkb.py --run_stage=cleanup --run_uri == this run uri, but the key here by throwing an exception up from here, we all the possibility to implement cleanup at the parent class in the future).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
GCP supports storage sizes from 1GB to 64TB currently. | ||
""" | ||
if size < 1 or size > 64000: | ||
sys.exit('Storage size flag given is not valid. Must be between ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
@@ -440,6 +454,7 @@ def Prepare(self, vm): | |||
|
|||
# Get a list of zones and pick one that's different from the zone VM is in. | |||
new_subnet_zone = None | |||
storage_size = self._ValidateSize(FLAGS.storage_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem necessary to return anything from the validatesize() function, if it never changes the size.
size: (GB). | ||
""" | ||
if size < 1 or size > 16000: | ||
sys.exit('Storage size flag given is not valid. Must be between ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change sys.exit() to exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more comments, getting close....
@@ -751,6 +791,18 @@ def Prepare(self, vm): | |||
logging.info('Set root password completed. Stdout:\n%s\nStderr:\n%s', | |||
stdout, stderr) | |||
|
|||
def _ValidateSize(self, size): | |||
"""Validate flag for storage size and throw exception if invalid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "." to the end. The google linter complains if there is no punctuation at the end of the summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
@@ -440,6 +458,8 @@ def Prepare(self, vm): | |||
|
|||
# Get a list of zones and pick one that's different from the zone VM is in. | |||
new_subnet_zone = None | |||
storage_size = FLAGS.storage_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variable storage_size is unnecessary, you can just use FLAGS.storage_size here and below.
Same comment for GCP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new commit.
size: (GB). | ||
""" | ||
if size < 1 or size > 64000: | ||
sys.exit('Storage size flag given is not valid. Must be between ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot this one? (sys.exit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes haha. Fixed in new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a travis build error with your most recent commit, please fix it.
Other than that, the rest of the code looks good.
LGTM from me, please wait for LGTM from Gareth as well. Once you have that, please do an end-to-end test with the final code, reply back when that is done. |
End to end testing with valid and invalid cases, acts as expected. |
@stfeng @gareth-ferneyhough
Adapt mysql_service_benchmark to handle storage size flag. Remove conflicting comments.
FYI @gareth-ferneyhough I did not change RDS side of this other than replacing the hard coded storage size with the flag value. This means that volume size is 1 so IOPS is capped will be capped by this.