Showing posts with label Amazon. Show all posts
Showing posts with label Amazon. Show all posts

Friday, December 20, 2019

Top 10 Lists for the Decade

As the 2010-2019 decade draws to a close, I will post (over the next 10 days - with a break on Christmas Day) a "Top 10" list on each of the following topics:

  1. Technology Disruptions (Later in this post)
  2. Business
  3. US News
  4. World News
  5. Medicine / HealthCare
  6. People (Influencers)
  7. Sports
  8. Movies
  9. Music
  10. Tragedies / Disasters
Here are my Top Technology Disruptions in the last decade:


1. SmartPhones - While the Smartphone existed in 2010, we continued to rely on multiple gadgets. Today, we have all these gadgets rolled into one.

2. Cloud, Data and AI - Computing has grown to become a utility over the last decade. Along with Big Data and Artificial Intelligence, these behind-the-scenes technologies power so many tasks that we do today.

3. Streaming - Netflix (app launched in 2010), Hulu and Amazon Prime have changed the face of entertainment. The $64m question is did bigger phone screens help Netflix become popular or was Netflix the reason why our phone screens got bigger?

4. Virtual Assistants - today it is common for 3-year old kids using their voice to command devices to play music. Between Siri, Alexa and Google, we can get the news, sports and weather using our voice.

5. Sharing Economy - Today, Airbnb has more room listings that all of the available rooms of the world's top five hotel chains combined. Uber (launched in 2010) was the first app to truly take advantage of faster cellular networks and improved location services on a SmartPhone

6. Autonomous Vehicles - Tesla led the way by turning the Model S into a self-driving vehicle by downloading an "upgrade". Talk about the mother of all in-app purchases! 

7. Wearables - Fitbit, Garmin and Apple made fitness tracking devices.  They helped us boost our daily activity by meeting goals for steps taken, tracking the amount and quality of sleep. They are moving towards mainstream MedicalCare as well.

8. Edge Computing - With the advent of 4G Networks (especially 4G LTE), SmartPhones no longer needed to be tethered to WiFi networks to be useful. With 5G offering a 10x to 100x improvement over 4G, the next decade promises to be exciting!


Friday, November 21, 2014

Starting replication for a very large MySQL database on Amazon EC2

In this post, I will outline steps used to start replication of a very large MySQL database from scratch.

Here is the problem that we faced:
  1. I had set up Master-Slave replication for a MySQL database in the beginning (using the simple steps outlined here)
  2. On both the Master and the Slave server, I had /var/lib/mysql point to an, IOPS optimized, EBS disk
  3. Since this data was very critical, I had set up a cron job to backup the database on the slave server
  4. I was monitoring the Master MySQL server with NewRelic and set up alerts when CPU, Memory or Disk consumption reached certain thresholds
  5. There were three mistakes that I did (for those of you setting this up from scratch):
    • Not setting up NewRelic on the Slave Server
    • Performing the backup on the same EBS disk as the DB partition
    • Not "cleaning up" or archiving older backups
  6. As a result of these mistakes, the Slave EBS disk became full and replication stopped
  7. I was blissfully unaware of this until a few days passed
  8. I cleaned up the Slave EBS disk, but I did not know where or when the replication stopped. So, I could not just resume the replication
At this time, here were the constraints that we were dealing with:
  1. There were already over 10m records in some tables and 60m records in some other tables.
  2. This was a live, production, system - so shutting it down (with a READ LOCK) was not an option
  3. Performing the replication and doing the database back up remained to be critical
  4. This task had to be completed in a few hours - because without it we ran the risk of being exposed
These constraints ruled out:
  1. Following the replication steps in the beginning of this post - since we could not do a READ LOCK
  2. Backing up the Database (on the Master) and restoring on the Slave - this would take too much time
Given these requirements and constraints, all the documented methods for resuming the Master Slave replication were ruled out. Here are steps taken to accomplish this task:

On the Master server:
  1. Edit my.cnf

  2.  server-id=1  
     binlog-format= mixed  
     log-bin=/var/lib/mysql/mysql-bin.log  
     datadir=/var/lib/mysql  
     innodb_flush_log_at_trx_commit=1  
     sync_binlog=1  
     binlog-do-db={DB to replicate}  
     binlog-ignore-db=mysql  
     binlog-ignore-db=information_schema  
     binlog-ignore-db=performance_schema  
     sync_binlog=1  
     innodb_flush_log_at_trx_commit=1  
    

  3. Restart Master MySQL server

  4. In the mysql command line on the Master, run the following commands:

  5.  CREATE USER replicant@{SlaveDBServerIP};  
     GRANT REPLICATION SLAVE ON *.* to 'replicant'@'{SlaveDBServerIP}' IDENTIFIED BY 'r3pl_us3r';  
     FLUSH PRIVILEGES;  
     GRANT RELOAD ON *.* TO 'replicant'@{SlaveDBServerIP};  
     GRANT SUPER ON *.* TO 'replicant'@{SlaveDBServerIP};  
     FLUSH PRIVILEGES;  
    

  6. Take a back up of the database in the Master MySQL  server using:

  7.  mysqldump -u {user} -p{password} --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 -A > dump.sql  
    

  8. Get the master_log_file and MASTER_LOG_POS from the MySQL dump:

  9.  head dump.sql -n80 | grep "MASTER_LOG_POS"  
    

  10. On your AWS console, take a Snapshot of the Volume housing your Master MySQL DB:
  11. Now create a Volume using the Snapshot-Id from above in the same AZ as the SlaveDB

  12. Attach this Volume to the SlaveDB instance
On the Slave Server:
  1. Point /var/lib/mysql to the mysql directory in the newly attached volume

  2. Start MySQL and verify that the MasterDB is now available on the slave server. Note that some records (towards the end) may be missing. That is ok. The steps that we will perform below will sync the DBs.

  3. Edit my.cnf

  4.  server-id=101  
     binlog-format = mixed  
     log-bin = /var/lib/mysql/mysql-bin.log  
     relay-log = /var/lib/mysql/mysql-relay-bin  
     log-slave-updates = 1  
     slave-skip-errors = all  
     read-only = 1  
     binlog-do-db={DBs to be replicated}  
    

  5. Restart the Slave

  6. In the mysql command line, run the following commands

  7.  change master to master_host={IP.Address.Of.Master},  
       master_user='replicant',  
       master_password='r3pl_us3r',  
       master_log_file='FROM#5ABOVE',  
       master_log_pos=FROM#5ABOVE;  
     STOP SLAVE;  
     RESET SLAVE;  
     SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;  
     START SLAVE;  
     SHOW SLAVE STATUS;  
    

    The Output will look similar to this:

     Slave_IO_State: Waiting for master to send event  
     Master_Host: master_ip  
     Master_User: rep_user  
     Master_Port: 3306  
     Connect_Retry: 60  
     .............  
    

    It may take a while to reach this state - depending on how many records need to be synced

Wednesday, October 20, 2010

An Open Letter to Steve Jobs

The world heard your tirade against RIM and Android on Monday. I understand that you are nervous over the fact that Android Sales have overtaken iPhone. As any good sales person would, you injected some FUD to deflect the positive press that Android has been receiving.

But it is just that - Fear, Uncertainty and Doubt. Usually, this is a sign of weakness - conceding to the enemy and "retaliating" with FUD. Fundamentally, your rant can be distilled to two issues:
  1. Fragmentation of Android resulting in developers spending more time testing than adding features
  2. Multiple Android Markets making it confusing for end users and developers
As a developer who has applications on both iOS and Android, I can tell you that I do not have the issue of having to "port" my Android code to multiple Android platforms. My code runs as-is across all Android devices.

Now, regarding the issue of multiple Android Markets, I think this is an advantage for Android. As a developer, this gives me multiple channels to have my app get downloaded. It is a matter of time before these markets provide an svn repository for my "bundle" (which includes screen shots, descriptions and the .apk file) that I simply upload to the various markets. The end-user can find the app within their context (either GetJar or Amazon or Google). Moreover, this keeps Google on its toes to constantly innovate. Competition always brings the best out in people.

You have always eschewed "open" and taken the I-know-what-is-best-for-you approach. The success of Linux for desktops/severs did not necessarily raise your antennae because the "fight" was for a much smaller percentage (Windows owns 90+% of the market. Linux/MacOS and others were competing for the scraps). However, the world of Smart Phones is a new era and an opportunity for "world dominance". Things were going well until Android started gaining momentum and started eclipsing the iPhone. Thus, the need for the rant.

I continue to be in awe of your genius. Your ability to provide clear thinking to a befuddled marketplace is phenomenal. Your legacy to our world of technology is unparalleled. So, you can understand my bewilderment with your scare tactics.

I believe there is room for two players in the market (three if RIM gets their act together quickly). Windows 7 is probably late to the party. However, if RIM does not watch out, the third player could well be Windows Phone 7. So, my request to you is to leave Android alone and focus on things that you have control over improving:
  • Reduce (or even remove) the approval time for apps on iTunes
  • Add recommendations to the iTunes store (similar to Amazon) including percentage of people who download the app, percentage of people who bought other apps, etc.
With Best Wishes,

Friday, January 15, 2010

Implementing SOA with Java EE Book


The book (that I co-authored with BV Kumar and Tony Ng almost two years ago) has finally published.


It actually released (on Borders, Barnes and Noble and Amazon) on December 31st 2009. I waited until it got some additional visibility before I posted about the book here. On Friday, Jan 15th, the book got mentioned in java.sun.com

I would like to thank Greg Doench for his tireless effort and determinedness to push the book through. Many times in the last year I would ask him, "Greg, are we really going through with this. I am not seeing things moving forward." He would calmly reply, "I am working on it." There is a companion site to the book that provides a sneak peek into the book. We will be using this site to provide updates, samples and take your comments.