December 16, 2016

World of Serverless Applications

Filed under: architecture,cloud Himanshu @ 2:48 pm

I still remember that night of year 1998. Me and my friend sat with a bunch floppies to install Novel Netware Server on a hardware physically sizing to about same as home refrigerator. And at next day morning we had server ready, giving us ability to share files among a bunch of PCs, and user management. The word “Server” would mean real big thing in those days. Exaggerated analogy could be “In those stone age days!” Lot of things changed in those stone age days v/s now, and today we are talking about Serverless architecture.

Serverless architecture really seems promising to me. It is new paradigm, and once developer toolset and frameworks matures around it, we would be going to new exciting world! Obviously Serverless architecture does not literally mean that there wouldn’t be any server, from that perspective the name is miss-leading. What in nutshell means is software engineer, and deployment team wouldn’t need to do provisioning of the software that solves business problem. Health monitoring software will take care of it, and that too depending upon load. Scalability needs starting from running on ‘No server’ to ‘N server’ will depend upon the load at a point of time. It all started when AWS one more time proving themselves to be leader in the area of cloud innovation, by introducing AWS Lambda in their offerings back in end of 2014. And recently Microsoft also published similar service in their Azure offering, called Azure Functions. Google’s GCP is also following  the lead and has offering with name Cloud Function.

Serverless architecture is Microservices and Scalability on steroid!

This are couple of scenarios that I think it fits best:

  • Startups can be most benefited with Severless architecture. In the beginning there will low usage, and hence less revenue, and hence need to have lessor cost on infrastructure and when the startup grows to large scale, the solution would react and scale to increased load automatically, and so would infrastructure cost. All of this without doing any code change, if Architected right in the beginning.
  • Another scenario could be of IoT web service endpoint to which devices connects to push or pull the data. Number of connected devices would drive the infrastructure cost dynamically.
  • Blogs and Content Management sites. Hey, this is big opportunity! There are many organizations in the world who do not want to have hassle of maintaining servers, do not want to spend a lot on infrastructure. But wants to have lightweight online presence. They will be greatly helped by having platform on which they pay by number of request coming to their site instead of fix hardware cost. What do you say? If you reach their before me, consider giving me credit for the idea :).

While all looks bright around Serverless architecture, here are few suggestions from my exploration:

  • Use coding framework that is light weight on it’s boot-up time. This will avoid having long request time after cold boot, I’m using node.js
  • While better toolsets for developers becoming ready and available for general community, consider using tools like Serverless package available on npm registry provided by Serverless.com. It works very well while working with AWS Lambda. It not only does the deployment of code on AWS Labda but also sets up HTTP endpoint in API gateway if event of Labda is configured to be HTTP endpoint. And everything works very seamlessly. Serverless package can be used even if your solution is not built in node.js
  • Never try to do lot of things together in one Lambda/Function. Break down time consuming work into multiple chunk of work-items and utilize AWS Simple Queue Service (SQS), or Azure Queues.
  • Do good enough logging, as that would be your savior to debug any issue.

Here is quick simple example. Let’s first go through requirements: Application allows user to create, view, edit and archive notes

  • User can add notes. Application records the note along with date-time when it was posted
  • While adding or editing notes, user can do formatting. Supported formatting would be making text bold, italic, and underline
  • User can view list of notes order by date-time it was posted in descending order
  • User can archive note. On archival note would be filtered out from the list of notes
  • User can review list of notes that are archived

Here is how it is structured:

serverless-201612

I’m in process of enhancing this example application with more features and in the process will end up using more of AWS services.

  • Authentication and Authorization,
  • Storing more structure along with note, like author, tagging the note, sharing the note with other subscribers.
  • Searching note
  • Attachments
  • Notification on shared note change

And to support these features will use DynamoDB, Simple Email Service (SES), Simple Notification Service (SNS) and Simple Queue Service (SQS), and more.

Also have plan to port this application on Azure, more blog posts to come.

September 10, 2015

Edge is giving priority to content

Filed under: Uncategorized Himanshu @ 12:11 pm

I’m on Windows 10, Yeah!

Today, I notice that when I press Alt+D in Microsoft Edge while having one JIRA issue open in the tab, instead of cursor moving to address bar, dashboards menu opens up in JIRA! When I’m editing this post in WordPress and press ALT+D, del html tag gets inserted in text area! However when I’m on Microsoft Edge page, it goes to address bar.

Giving priority to content rather than browser, I liked that idea. This will help having more web applications supporting keyboard shortcuts, and users can be more efficient in using applications.

I liked it!

June 3, 2015

Code refactoring is important

One great mind have said it well that “Change is the only constant in the life”

What is the difference between hardware and software? One aspect suggests that “Hardware is likely to have mechanical parts that are subjected to wear and tear, and will need maintenance and replacement to extend continues service. While software do not have any mechanical parts and it is not subject to wear and tear.” 

If we live in static world, this would be true, but unfortunately or rather fortunately we don’t live in static world. Like many other things, software or the environment within with it gets used changes. Change in the way business operates that uses the software i.e. requirement change, enhancements to support extended business needs, change in environment within which software was assumed to run, or any other assumption within which software was built proves to be wrong, these are some of the example why software needs regular maintenance.

In science entropy is well used word for explaining gradual decline in disorder. It is bound to happen, over the period of time till equilibrium is achieved. If I draw the analogy, well engineered code at one point is order state. In changing world demand towards software changes, and  it will be inevitable to have the situation in life cycle of the software that it would go towards disordered state. I have accepted this to be fact until proven wrong, and based of I would suggest business that depends on the software that put effort and money to bring the software back to ordered state, otherwise one is bound to pay higher cost down the line. Do talk to engineering team to understand accumulated disorder, and prioritize it in the backlog. Earlier it is done better it is.

May 27, 2015

SQL Server selecting from literal values

Filed under: sql server Himanshu @ 11:40 am

I didn’t knew it as possible to do this in SQL Server:

select * from (values (1, 2), (3, 4), (5, 6)) AS Numbers (Odds, Evens)

Parking it here for my later reference. Can be handy to insert couple of rows into some meta tables like:

declare @external_internal_state_map table (external_state_code varchar(6), internal_state_code varchar(6))
insert into @external_internal_state_map (external_state_code, internal_state_code) values
(‘EXT1’, ‘INT1’), (‘EXT2’, ‘INT2’), (‘EXT3’, ‘INT3’)
select * from @external_internal_state_map

May 27, 2014

Shorten the path by mapping drive letter pointing to folder

Filed under: Uncategorized Himanshu @ 12:59 pm

While working on a project, I noticed that Visual Studio was failing while doing compilation, and reason for failure was path was becoming too long.

There is subst command in MS Windows allowed me to setup a driver letter that points to physical folder to overcome the situation.

Ref: https://technet.microsoft.com/en-in/library/bb491006.aspx

August 15, 2012

Mathematics Reloaded

Filed under: electronics — Tags: , , , Himanshu @ 12:22 pm

I got stuck in one puzzle of electronics. Was understanding resistance of electron flow, current, and voltage by little different experiments. In one of them, I had created a very basic circuit that was starting from +v end of 1.5v battery (showing 1.4v on multimeter without resistance), 470k resister and multimeter into the circuit ending at –v end of the battery. On multimeter, I noticed 0.95v.  470k resister was the cause for the drop of voltage and it was dropping voltage by 0.45v (1.4v – 0.95v = 0.45v).

I thought of using one more 470k resister expecting it to drop further 0.45v and confirm that voltage drops  to 0.5v after second 470k resister. My reasoning was: 1.4v – 0.45v – 0.45v = 0.5v. But to my surprise I was seeing 0.71v on multimeter! Multimeter wasn’t in agreement of my mathematics, but I wasn’t fully convinced with multimeter’s mathematics. All I was thinking is “Why” second resister was not dropping the voltage as equally as the first.

After further thinking and learning on V=IR, I notice very simple and basic property in numerical series in which next number is created by adding 1 to the predecessor viz. 1, 2, 3, 4, …n. And that simple and basic property is: 2 is double of 1 but 3 isn’t double of 2. Further, weight of 3 is 50% more than 2, but weight of 4 is not 50% more than 3.

Of course it’s obvious but it wasn’t so obvious to me before this experiment!

June 27, 2012

Installing ASP.NET MVC 3 and Web Platform Installer

Filed under: asp.net — Tags: , , , Himanshu @ 12:01 am

I had a problem in using the Visual Studio Install that I had in my machine, due to which I decided to re-install everything related to Visual Studio , including Visual Studio itself.  During installation procedure, I reached to the point when I was ready with base Visual Studio 2010 installed, and next step was to update system with bunch of other frameworks and patches that included ASP.NET MVC 3, Visual Studio 2010 SP1, and some other. It was making sense to me to install all together with Web Platform installer. Added everything that I wanted to install in Web Platform installer and asked it to install. It happily declared everything done. But when I tried opening the project solution, Visual Studio complaint about missing ASP.NET MVC 3.

On further investigation about why and what, surprise! ASP.NET MVC 3 actually was missing on the system! Web Platform installer was fooling me when it said “Completed everything”. Finally I found that due to Latest NuGet install on my machine, installer for MVC 3, was not able to successfully install.

Leaky Abstraction!

June 12, 2012

Transistors are also De-amplifier

Filed under: electronics — Tags: , , , Himanshu @ 1:08 pm

I’m enjoying my exploration of electronics. While understanding about different building blocks, I learnt about Transistor. And I also learnt that transistors are also called amplifiers. During learning about their amplification capability, I also realized that they are certainly amplifier but they don’t generate electricity from air (unfortunately!). They need two input voltage one at Base and another at Collector. When Base is positively charged – low voltage applied to it, they allow higher voltage applied at Collector to pass towards Emitter, and that’s how they are called amplifier.

Me being fresher in electronics, I recommend other fresher to also note that if you see through transistors from Base to Emitter they are certainly amplifiers, but if you see through Collector to Emitter, they are de-amplifiers as they don’t generate electricity from air.

June 7, 2012

SessionStorage on Safari

Filed under: html5 — Tags: , , , , Himanshu @ 10:23 am

Like everything in life has quota, Safari allots specific size to each applications that it can consume to store information in session storage. If consumption exceeds, while calling setItem it throws QUOTA error.  While creating one HTML5 based application for one of the client. I found that Safari that comes on iPad 1 built on top of AppleWebKit 531.21.10 has two reason to throw this error. First like I said on exceeding the limit and another on when an key already exists. To workaround the second case, have to write our own function that first removes item using removeItem and then SetItem

July 20, 2011

Word documents and merging two branches

Filed under: ms office — Tags: , Himanshu @ 11:46 pm

Do you create word documents? Do you send them for review to your boss? I think, answers of both of these questions will be “yes” for most people, and I’m not exception! MS Word have a good feature – Track Changes. As it’s name suggests, it  tracks the changes while document is being edited, and can show final (edited version) of the document or can show final document with highlighting changes . While changes are highlighted, they are easy to notice and can also navigation across changes easily.

But, if your boss forgot to start the change tracking, then? Well, not to worry, word can do merging of two different branches like a version control. Steps:

  1. Very important! Make sure you are having extra copy (backup) of both the documents (your copy and boss’s copy). Just in case we create mess in the process, you don’t loose your valuable information in these documents.
  2. After making sure both documents (e.g. “My Copy” and “Boss’s Copy”) are closed, open “Boss’s Copy” document in MS Word.
  3. Invoke “Save as“ operation and try and save it over “My Copy” of the document. (Notice already open document name and Save as name in the image)
  4. Word should prompt you for different available option, having one of them to be “Merge changes into existing files” (for example, as  depicted in image), select it and continue with “Save as” operation.

In the result of above, “My Copy” document will be updated as if Boss have changed the document while having “Change Track” on.

SaveAs-And-Overwrite-Me

Older Posts »

Powered by WordPress