Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
48d77ea2
Unverified
Commit
48d77ea2
authored
Nov 09, 2017
by
Carl Bergquist
Committed by
GitHub
Nov 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9785 from certusoft/mysql_performance
MySQL Performance when using GF_DATABASE_URL
parents
56fe1308
a51b1e89
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
conf/defaults.ini
+3
-0
conf/sample.ini
+2
-0
docs/sources/installation/configuration.md
+3
-0
pkg/services/sqlstore/sqlstore.go
+10
-6
No files found.
conf/defaults.ini
View file @
48d77ea2
...
@@ -82,6 +82,9 @@ max_idle_conn = 2
...
@@ -82,6 +82,9 @@ max_idle_conn = 2
# Max conn setting default is 0 (mean not set)
# Max conn setting default is 0 (mean not set)
max_open_conn
=
max_open_conn
=
# Set to true to log the sql calls and execution times.
log_queries
=
# For "postgres", use either "disable", "require" or "verify-full"
# For "postgres", use either "disable", "require" or "verify-full"
# For "mysql", use either "true", "false", or "skip-verify".
# For "mysql", use either "true", "false", or "skip-verify".
ssl_mode
=
disable
ssl_mode
=
disable
...
...
conf/sample.ini
View file @
48d77ea2
...
@@ -91,6 +91,8 @@
...
@@ -91,6 +91,8 @@
# Max conn setting default is 0 (mean not set)
# Max conn setting default is 0 (mean not set)
;max_open_conn =
;max_open_conn =
# Set to true to log the sql calls and execution times.
log_queries
=
#################################### Session ####################################
#################################### Session ####################################
[session]
[session]
...
...
docs/sources/installation/configuration.md
View file @
48d77ea2
...
@@ -224,6 +224,9 @@ The maximum number of connections in the idle connection pool.
...
@@ -224,6 +224,9 @@ The maximum number of connections in the idle connection pool.
### max_open_conn
### max_open_conn
The maximum number of open connections to the database.
The maximum number of open connections to the database.
### log_queries
Set to
`true`
to log the sql calls and execution times.
<hr
/>
<hr
/>
## [security]
## [security]
...
...
pkg/services/sqlstore/sqlstore.go
View file @
48d77ea2
...
@@ -158,10 +158,14 @@ func getEngine() (*xorm.Engine, error) {
...
@@ -158,10 +158,14 @@ func getEngine() (*xorm.Engine, error) {
}
else
{
}
else
{
engine
.
SetMaxOpenConns
(
DbCfg
.
MaxOpenConn
)
engine
.
SetMaxOpenConns
(
DbCfg
.
MaxOpenConn
)
engine
.
SetMaxIdleConns
(
DbCfg
.
MaxIdleConn
)
engine
.
SetMaxIdleConns
(
DbCfg
.
MaxIdleConn
)
engine
.
SetLogger
(
&
xorm
.
DiscardLogger
{})
debugSql
:=
setting
.
Cfg
.
Section
(
"database"
)
.
Key
(
"log_queries"
)
.
MustBool
(
false
)
// engine.SetLogger(NewXormLogger(log.LvlInfo, log.New("sqlstore.xorm")))
if
!
debugSql
{
// engine.ShowSQL = true
engine
.
SetLogger
(
&
xorm
.
DiscardLogger
{})
// engine.ShowInfo = true
}
else
{
engine
.
SetLogger
(
NewXormLogger
(
log
.
LvlInfo
,
log
.
New
(
"sqlstore.xorm"
)))
engine
.
ShowSQL
(
true
)
engine
.
ShowExecTime
(
true
)
}
}
}
return
engine
,
nil
return
engine
,
nil
}
}
...
@@ -190,12 +194,12 @@ func LoadConfig() {
...
@@ -190,12 +194,12 @@ func LoadConfig() {
DbCfg
.
Host
=
sec
.
Key
(
"host"
)
.
String
()
DbCfg
.
Host
=
sec
.
Key
(
"host"
)
.
String
()
DbCfg
.
Name
=
sec
.
Key
(
"name"
)
.
String
()
DbCfg
.
Name
=
sec
.
Key
(
"name"
)
.
String
()
DbCfg
.
User
=
sec
.
Key
(
"user"
)
.
String
()
DbCfg
.
User
=
sec
.
Key
(
"user"
)
.
String
()
DbCfg
.
MaxOpenConn
=
sec
.
Key
(
"max_open_conn"
)
.
MustInt
(
0
)
DbCfg
.
MaxIdleConn
=
sec
.
Key
(
"max_idle_conn"
)
.
MustInt
(
0
)
if
len
(
DbCfg
.
Pwd
)
==
0
{
if
len
(
DbCfg
.
Pwd
)
==
0
{
DbCfg
.
Pwd
=
sec
.
Key
(
"password"
)
.
String
()
DbCfg
.
Pwd
=
sec
.
Key
(
"password"
)
.
String
()
}
}
}
}
DbCfg
.
MaxOpenConn
=
sec
.
Key
(
"max_open_conn"
)
.
MustInt
(
0
)
DbCfg
.
MaxIdleConn
=
sec
.
Key
(
"max_idle_conn"
)
.
MustInt
(
0
)
if
DbCfg
.
Type
==
"sqlite3"
{
if
DbCfg
.
Type
==
"sqlite3"
{
UseSQLite3
=
true
UseSQLite3
=
true
...
...
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