principlesqlMinor
Does MVC architecture design pattern effect MySQL database performance?
Viewed 0 times
effectarchitecturemvcdesigndatabasemysqlperformancedoespattern
Problem
Our current site is entirely developed in the cakePHP framework with the MVC architecture. If we notice more than around 19-20 users viewing the site at once, it begins to crawl to a hault and begin to time out.
Could this be a performance issue with MySQL? Possibly related to MVC - as the site relies heavily on communication with the SQL database. If so, would increasing the overall RAM help solve the issue?
Thanks.
Config:
```
open-files-limit = 20000
#sql-mode = TRADITIONAL
#event-scheduler = 1
### Cache
thread-cache-size = 16
table-open-cache = 2048
table-definition-cache = 512
query-cache-size = 32M
query-cache-limit = 1M
### Per-thread Buffers
sort-buffer-size = 1M
read-buffer-size = 1M
read-rnd-buffer-size = 8M
join-buffer-size = 1M
### Temp Tables
tmp-table-size = 64M
max-heap-table-size = 64M
### Networking
back-log = 100
max-connections = 300
max-connect-errors = 10000
max-allowed-packet = 16M
interactive-timeout = 600
wait-timeout = 60
net_read_timeout = 30
net_write_timeout = 30
# This value is the size of the listen queue for incoming TCP/IP connections.
back_log = 128
#### Storage Engines
#default-storage-engine = InnoDB
## Makes sure MySQL does not start if InnoDB fails to start. This helps
## prevent ugly silent failures.
innodb = FORCE
### MyISAM
key-buffer-size = 64M
myisam-sort-buffer-size = 128M
#InnoDB
innodb-buffer-pool-size = 16M
innodb-log-buffer-size = 4M
innodb-log-files-in-group = 2
server-id = 1
[mysqld-safe]
log-error = /var/log/mysqld.log
[mysqldump]
max-allowed-packet = 16M
Could this be a performance issue with MySQL? Possibly related to MVC - as the site relies heavily on communication with the SQL database. If so, would increasing the overall RAM help solve the issue?
Thanks.
Config:
```
open-files-limit = 20000
#sql-mode = TRADITIONAL
#event-scheduler = 1
### Cache
thread-cache-size = 16
table-open-cache = 2048
table-definition-cache = 512
query-cache-size = 32M
query-cache-limit = 1M
### Per-thread Buffers
sort-buffer-size = 1M
read-buffer-size = 1M
read-rnd-buffer-size = 8M
join-buffer-size = 1M
### Temp Tables
tmp-table-size = 64M
max-heap-table-size = 64M
### Networking
back-log = 100
max-connections = 300
max-connect-errors = 10000
max-allowed-packet = 16M
interactive-timeout = 600
wait-timeout = 60
net_read_timeout = 30
net_write_timeout = 30
# This value is the size of the listen queue for incoming TCP/IP connections.
back_log = 128
#### Storage Engines
#default-storage-engine = InnoDB
## Makes sure MySQL does not start if InnoDB fails to start. This helps
## prevent ugly silent failures.
innodb = FORCE
### MyISAM
key-buffer-size = 64M
myisam-sort-buffer-size = 128M
#InnoDB
innodb-buffer-pool-size = 16M
innodb-log-buffer-size = 4M
innodb-log-files-in-group = 2
server-id = 1
[mysqld-safe]
log-error = /var/log/mysqld.log
[mysqldump]
max-allowed-packet = 16M
Solution
We use cake for some internal applications. And yes it does at times, pardon my french, suck. This isn't anything to do with mysql per se. Once you start defining more than basic models and go down the "has many"/"has many belongs to many" relationships, the underlying queries it generates can be less than sub par.
Do you have table with multi column primary keys? Forget about it.
Frankly there are just times you need to break the molding your framework is supposed to shield you from and write your sql more directly :-\
That being said, as with anything else interacting with your DB you'll want to ensure you have proper indexes and appropriate buffer pool/key buffer.
Do you have table with multi column primary keys? Forget about it.
Frankly there are just times you need to break the molding your framework is supposed to shield you from and write your sql more directly :-\
That being said, as with anything else interacting with your DB you'll want to ensure you have proper indexes and appropriate buffer pool/key buffer.
Context
StackExchange Database Administrators Q#13348, answer score: 3
Revisions (0)
No revisions yet.