Apache and MySQL installation on VPS - mysql

Is there any difference (or preference) between two schemes:
Apache & MySQL are installed on the same VPS (4Gb RAM, 2 CPU Cores) and each of them configured for 2GB RAM,
Apache and MySQL installed on separate VPS (2Gb RAM, 1 CPU Core).
Thank you.

It is better to go for separate vps server
Following are the reason
1) can boost performance, u can balance the load equally
2) easier to set up replication if you have separate standalone DB server
3) easier to trouble shoot if there is a problem either in apache or mysql
4) normally if you have separate DB instance, you will allocate 80% of your RAM memory to Myisam or Innodb engine for better concurrency. If both kept in same vps, u will have to sacrifice concurrency, scalability

Related

Do I need separate servers for Mysql Dev and Live databases in order to optimize memory usage?

My question is about mysql databases on same hardware / mysql instance and how it affects memory usage: INNODB_BUFFER_POOL more specific.
Today, we have all our DBs: Dev, BackUp and Live; residing on same rack/mysql server instance.
Would it be useful to build new server? Like Separate hardware and mysql instance to allocate better memory for each needs (DEV,BackUp,Live)? Is there a way to allocate memory for each DB individually if they reside on same hardware / mysql instance?
Ex: DB1 can use max 64GB RAM, DB2 only max 16GB
I was thinking about building a standard server, for backup and Development, Testing. For the Live(production) server leave a better build ( memory, hardware) and leave it as dedicated as possible with only DB and tables needed.
Here some article I was reading as reference regarding what Im trying to explain.
https://haydenjames.io/mysql-performance-drop-unused-databases/
Thanks

Much slower MySQL performance on virtualized server

I'm in the process of both virtualizing and updating an old Linux server running a reporting system developed in house (Apache, MySQL, PHP).
The old physical server is running 64-bit Ubuntu 10.04.3 LTS, MySQL 5.1.41 and PHP 5.3. The server has an Intel Xeon CPU X3460 # 2.80GHz (4 cores), 4GB RAM.
We have ESXI 5.5 running on an HP DL380G6 with 2 x Intel Xeon X5650 6 Core 2.66ghz and 32GB RAM.
I created a new VM with 4 cores and 4GB RAM, and did a clean install of 64-bit Ubuntu 16.04.4 LTS, MySQL 5.7.21 and PHP 7.0, migrated our app, and everything is running much slower. I believe it's MySQL because when doing the same direct query on the old physical server vs the new virtualized one, queries can take 8 seconds (VM) instead of 1 (Physical). The tables all have appropriate indexes, running "EXPLAIN" on each server provides the same results, yet one is substantially slower. When a page is running numerous complex queries, it can take a minute+ to load instead of a few seconds.
Any idea why this can be? Same dataset, same query, same engine (MyISAM). The VM has much more recent versions of everything, same number of cores and same RAM. I even tried doubling the VM CPU to 2 sockets, 4 cores and 8GB RAM, and it doesn't seem to have a substantial impact.
I've compared the MySQL configuration and nothing is jumping out at me at being very different.
What might I be missing here? Is it the virtual host hardware?
Did you upgrade the vmware tools? if not do so.
Then, on this ESXi host, do you have other VMs on it? If yes, I would advise you to create a resource pool and then configure the resource limits.
In the resource pool the amount of resource you assign will be in a way reserved for your VM, so you won't have to share with other VMs.

Magento on 8GB RAM VPS - MySQL performance

I've got VPS with 8GB RAM and 256GB SSD. Now, on that server, I have a Magento install that has ~100k products in it. That said, once a day I run an importer to go through products and import/update them, but it always fills up my memory and VPS goes unresponsive. I've 1GB PHP memory limit, and 5GB innodb_buffer_pool_size. Everything else is by default. My server is on Ubuntu 16.04.
Vast number of products, combined with poorly coded queries resulted in spending actually all the memory my VPS was assigned to, hence the MySQL restarting.

mysql server overload due to many queries at once

I have an application on my server that uses many database requests to a reasonable simple and small database (10Mb size).
The number of simultaneous requests can be around 500. I have an Apache & Mysql server running on linux with 8GB RAM and 3 cores.
I've upgraded the server recently(from 512mb to 8GB), but this is not having effect. It seems that the aditional CPU and RAM is not being used. Before the CPU hit 100%, but after the upgrade I still get status WARN at only 40% CPU usage:
Free RAM: 6736.94 MB
Free Swap: 1023.94 MB
Disk i/o: 194 io/s
In the processes, the mysqld cpu usage is 100%.
I can't figure out what the right settings are to make the hardware upgrade work for mysql and MyISAM engine.
I have little experience with setting up and configuring a server, so detailed comments or help are very welcome.
UPDATE #1
the mysql requests are both readers and writers from a large number of php scripts.

Tomcat and MySql on VPS

I am doing some experimentation with VPS before moving my application from private Tomcat hosting to cloud. It is a read intensive app built on Struts 2 + Spring + Hibernate + MySql. Its a moderately popular app in India with 1500 visitors and 10,000 pageviews per day. I have some basic questions about choosing a server configuration.
1) Would it be enough to have 256M RAM for running both Tomcat and Mysql. I wont be running anything else other than SSH. No apache, FTP etc. My current heap size is 190M. can i still set the heap size as 190M with 256M RAM? What are the pros and cons?
2) Is it better to have 2 256M servers one with Tomcat and one with Mysql? or 1 server with 512M running both MySql and Tomcat?
I am open to any suggestions. Thanks!
1)
I think it could be done.. I've seen a similarly sized app running on 256MB Linux VPS.
However, you're leaving very little memory for MySQL, which will cause it to have to go to disk often. It could be quite slow.
2)
One server is better than two. You have less to configure and you don't pay for the OS + virtual machine container overhead twice. Also, your app server and your database may not use equal memory, so being on separate machine could be an inefficient use of memory.
I don't believe a 256MB VPS can effectively run a Java WebApp. You need at least a 512MB VPS. I wouldn't consider splitting until you go past a 1GB container. When you split, you have the overhead of the OS running 2x. One of the advantages of splitting though, is you may have more burst-able capacity. If the two VPS are on separate hardware and you get a rush of traffic, you may be able to use more CPU cycles than a single container on a single host. This depends on the load of the other containers of course, and your VPS provider's policy on bursting.