Data transfer between local server and AWS server - mysql

We have an ASP.NET MVC 5 web application that reads data locally from within the same server. This server is in Europe. However when trying to read the same data from an AWS server based in Sidney the lag is many times greater. A ping from our local server to the AWS server in Australia takes 5 seconds. The data needs to be located in Australia because of data protection laws issued by the Australian Government. The database is MySQL. We have created a VPN between both servers and made no difference.
What are our options in order to improve the speed between these two servers?

If it is a web application serving content to users over internet you can use CloudFront distribution to reduce your latency issues.
https://aws.amazon.com/cloudfront/
If you are trying to connect your servers from your data center to AWS
Use AWS Direct Connect, this will provide a dedicated link between your on-premise datacenter and to the AWS Servers; Decreasing your latency by a lot.
https://aws.amazon.com/directconnect/
AWS runs your application regardless of which platform(ASP.NET, JAVA, C...) it is, AWS only provisions infrastructure. You don't need to worry about the platform on which your application is running and what database it connects to. You just need to ensure that all the network connections are properly open so that your servers can communicate with AWS servers.

Related

Where are databases stored?

Where are databases actually stored? Do we store the database in the web server itself (like NGINX or Apache), or do we have any other kind of server dedicated to only the database, if this is the case, how would we connect to the database from another machine?
For example, I've tinkered with MySQL databases stored in my local machine, which i used to create web applications: how could i store (host) those databases somewhere else in another machine and still use them in the same web application running on a completely different machine?
Where is the database stored?
The database -- the relational database management system -- is a network-accessible hunk of server code. MySQL, for example, is a server software package.
That server software runs on a computer -- in internet parlance a server machine -- somewhere. Maybe it's on your laptop. Maybe it's on a server machine in the next room. Maybe it's on a virtual machine you rent from AWS,Azure, Digital Ocean, or some other cloud vendor.
The machine hosting the database for a web site can be the same machine that hosts the web site's web server, or a different machine. Modestly sized web sites often run the database and the web server on the same machine. Bigger sites often have multiple web server machines all using just one database machine.
As long as the web server code can reach the database server via a TCP/IP connection, you have a working configuration.
Where is the database stored?
The database server software uses the file system (disk, SSD drives, or network-attached storage) of its host machine to store the data in its tables. The structure of the file-system files used by the database server software is a huge topic far beyond the scope of a StackOverflow answer. Suffice it to say that those files are useless without the database server software to read, write, and back them up ( with a few special exceptions).

Redirect all the mysql requests to other DB server

I have a staging server on AWS where my web application is running.the application uses Dedicated Database server(mysql/linux) from other provider. i would like to spin a new server on a AWS that should act like a proxy server to connect with my Dedicated Database server.
please advise me how can i achieve.
You can proxy the traffic with HAproxy, you can have one DB in active mode and one in passive mode, when ready to cut over you take the active one offline and ha will start sending requests to the other DB server.
Additionally, HAproxy will allow you to send traffic to certain DB servers depending on a variety of criteria, like the source IP. So some web apps send to one DB and others send to another.
HA proxy is very lightweight, we use it and run hundreds of thousands of requests a day without any performance issues.
Take a look at MaxScale from MariaDB. it a DB proxy. the can do all this and more..
https://mariadb.com/products/mariadb-maxscale

AWS RDS read replicas interaction with application

I am very new to cloud computing. I have never worked with MySQL outside of 1 instance. I am trying to understand how AWS RDS read replicas work with my application. For example say I have 1 master and 2 read replicas. I then from my application server send the query to AWS:
SELECT * FROM users where username = 'bob';
How does this work now? Do I need to include more into my code to choose a certain read replica or does AWS automatically reroute the request or how does it work?
Amazon does not currently provide any sort of load balancing or other traffic distribution across RDS servers. When you send queries to the primary RDS endpoint, 100% of that traffic goes to the primary RDS server. You would have to architect your system to open connections to each server and distribute the queries across the different database servers.
To do this in a way that is transparent to your application, you could setup an HAProxy instance between your application and the database that manages the traffic distribution.
Use of Elastic Load Balancers to distribute RDS traffic is an often requested feature, but Amazon has given no indication that they are working on this feature at this time.

Implementing SSL in Java Based Web Applications

I have a java based web application developed in Amazon EC2. It is doing transactions of confidential information. I have a MySQL server installed all by my self in the same amazon instance. The web application access the database via localhost. In Security Groups, I have created a custom security where the port 8080 (the Tomcat) can be accessed only via localhost.
Considering these, do I still need SSL to make sure the transactions are secured?
It depends. Are you comfortable with plain text inside the datacenter? Don't bother with SSL.
Are you worried about that traffic being sniffed locally (tcpdump) or from a malicious source (for instance, if data was being rerouted from the switch between EC2 instances)? Use SSL.
There's a trend of large companies making sure to encrypt local traffic.

Primary Server and Hot Standby Server architecture

I am now starting to look into building the proper architecture for Intranet network with one Primary Server and a Secondary Server that I would like to operate as a hot standby.
My knowladge of this is quite minimal and I am looking for guidelines and articles that would get me started.
The Server that needs to be replicated will run the following:
- Windows Server 2008 R2 OS
- MS SQL 2008 R2 Std
- IIS 7.0 that will run a web application built in asp.net
- Several background services, some of them write data to the database. This are .net applications that were written in house but with no replication methodology.
My goal is to have the Primary Server data constantly replicated to the Secondary Server so that in case of failure the Seconday Server can start acting as Main Server ASAP.
My questions are:
1. What is the recommanded hardware topology in this case? Besides of the two server machines, do I need any extra hardware that will act as a DNS server to resolve rounting to the correct server?
If not, how can this be done with software?
2. Data base replication - I understand that I will need to use some sort of log shipping in order to syncronize between the databases. What are the limitations and guidelines? I need to know if there is a tradeoff for good performace vs. having an up-to-date replication of the database. A good article will be helpful.
3. Considering that rewriting the services application to support running in some sort of "passive" mode and transmitting state-data between the servers is probably not possible, what should be done with those services on the secondary machine?
I think you have the wrong approach to this, instead of using a hot standby you should use load balancing and clustering to provide availability.
My recommendation is to run the web application on both servers and use an IP Load Balancer to distribute requests between the two servers. If one of the servers becomes unavailable user requests will no longer be routed to that server and users will not really notice that a disruption has occurred. You should try to make use of an exising load balancer in your companies infrastructure.
If you have more than two servers available I would also recommend that you look at Windows Network Load Balancing (NLB) which a feature included in Windows Server, read more about NLB at http://technet.microsoft.com/en-us/library/cc725691.aspx. But as NLB and fail-over cluster is not supported on the same servers I cannot recommend that if you only have two servers.
For the database I would recommend that you use a 2-nodes active-passive database cluster, instead of deploying two separate SQL instances with replication between them. In a cluster configuration SQL Server runs on a single server but if that server has a problem SQL Server automatically switch over to the other server. Read more about SQL Server clustering at http://sql.starwindsoftware.com/sql-server-clustering-technology.
Implementing a clustering solution will require some sort of shared disk between the two server, because both servers can be active instances they have to be able to write to the same disks. If your organization has a SAN available then that is the preferred choice for the shared disk.
But now comes the problem with the background services. If they cannot be modified you just have to come up with some mechanism to move them if a server fails. If the servers are monitored you could have a technician initiate a script which starts the services on the other server. Manual operations are never reliable, but if you cannot rewrite them you don't have much choice.
If you have two server I recommend:
HW IP Load Balancer
|
-----------------------------
| |
SERVER A SERVER B
ASP.NET web app ASP.NET web app
SQL Server (active) SQL Server (passive)
Bg services (not running) Bg services (running)
I you have four servers I would recommend:
HW IP LB or Windows NLB
|
-----------------------------
| |
SERVER A SERVER B
ASP.NET web app ASP.NET web app
| |
-----------------------------
|
-----------------------------
| |
SERVER C SERVER D
SQL Server (active) SQL Server (passive)
Bg services (not running) Bg services (running)