Monday, November 12, 2018

Free Tier Serverless Cloud Platforms

Last week I was trying to write an Amazon Alexa Skills (Earlier I had created Google Assitant App using dialogue flow ) and found creating Alexa app was not as intuitive as dialogue flow as a beginner. Probably it's just the UI/UX. There are much more incentives of creating Google assistant apps as it can be accessed via android phones right from your lock screen as opposed to Alexa skills which you need to use the echo devices or Alexa app on phone and keep it running in the background.

Nevertheless I needed a service endpoint which would feed data to my Alexa app and the recommended way was to have an AWS lambda function, however, you could also put any public endpoint URL of your own. I recently did a lot of work on Google Cloud Function so I opted for it. Tough the network latency may be marginally more because now Amazon data centre needs to talk to Google data centre. But the difference was smaller when compared to my home internet connection's latency to cloud. is a great tool to know your nearest GCP zone where you can deploy your services if the userbase is around your location. For me of course it was Mumbai which is one of the recent data centre of Google Cloud Platform.

Google Cloud Functions Free tier.

The factor that outweighed the latency factor was a free tier. Since it was a side project I had to run it for free as long as possible. I found Google Cloud Function's free tier quota is twice as much as AWSs for the same memory and network quota. Cloud functions offered first 2 million invocations free while both  AWS lambda and Azure functions had only 1 million free calls per month. In fact, Azure charges you for the storage that is used for staging the code file. I remember Cloud functions used to ask for a storage bucket for the same but in the recent version, they have made this process transparent to the user and just give you the location where it uploads internally.  Cloud Functions tough limited to only a few languages was pretty good for me. One good thing about the serverless platform is you are charged only when it is invoked, there is no VM running that you have to pay for even if no one is using it, which is the case for new projects as you never know if users are going come or not. I am sure I did not take all factors into consideration so I put this question our for experts

Google Developer Expert Romin has some valid points about it.

One can also use firebase functions' spark plan if you don't have any outbound calls outside Google's network.

Tuesday, October 30, 2018

GDG Devfest 2018 Hyderabad

It was the 7th year in a row Google Developers Group hosted their flagship event devfest in Hyderabad. This time it was big because it was not only a 2-day event with dedicated days for sessions and codelab/workshops, but also it accommodated more than 600 developers including professionals and students.

Workshop - Google Cloud Functions with Node.js (No, I am not playing Guitar here :) )

Lately, I have been working on Google Cloud Functions at work as it went GA during the GCP Next'18 earlier this year. I decided to submit a proposal around the same for this event. Slides and Code Lab instructions. 

While the proposal was accepted by the committee, it was moved to code lab instead of a session as it was more of a hands-on session and not much advanced for someone not who have not done cloud functions earlier.  While I was preparing the steps which I will ask participants to follow during the workshop, I realized there was a big problem in terms of GCP projects. Cloud Functions requires a GCP project which is billing enabled although it is free up to a few millions of invocation and enabling billing for GCP projects needs a credit card. I could not really expect participants to punch in their credit card number for the project they were supposed to create to deploy their functions along with me.

I realised from Stackoverflow that Firebase functions have a tier in which it is free and you don't need a billing account for Firebase project. Firebase functions and Google Cloud Functions are similar except some differences in the syntax how you define the function. Both run  Node.js and confirm to ExpressJS request-response interfaces. It looked like I could not demo Firebase functions instead of Google Cloud Functions. While doing the POC I very soon realised that Firebase functions did not have the same tools for deploying locally or debugging that Google Cloud Functions. My main agenda was to demonstrate the full work flow including local testing, debugging, writing tests, deploying to cloud and debugging in the cloud. Some of these were not possible with Firebase Functions. I could not even use the emulator to deploy locally. Firebase has its own way of serving locally and it has an interactive shell instead of letting you put breakpoints like traditional debugging. That was a turn-off.

At this time I was determined there has to be a way to demo Google Cloud Functions and still let the audience deploy their code. It occurred to me that I could let people deploy their functions in my project itself exactly like what we do at work. We just give "Editor" role to the team members to various GCP projects so that they can view and edit resources. Also instead of giving every Google account/Gmail id, I decided to create a Google Group where people can just join and get access to my demo GCP project once I approve. I just had to add the Google Group Id to the project as "Editor" instead of adding individual ids which had to be sent by the user one by one.

Problem solved ! (Well, as long as no one abuses and my card gets charged ;) )

Now I could just focus on the content. So the idea was to write a simple node.js function which can be deployed to functions emulator locally and tested. This could also be debugged locally using VS Code or Chrome's Dev tools. Finally, it was supposed to be deployed in the cloud. Even in cloud stackdriver's debug snapshot could be used to inspect variables and log points could be used to add logs on the fly instead of having to re-deploy every time we try to debug an issue in production which is not reproducible locally. If this was not enough content I also had a plan to demo Google text to Speech api integration with it where one can provide the text, language and gender as the parameter to the HTTP endpoint and it could stream/download the audio file back.

The workshop finally went well, I was glad to see many people deploying their functions even before I did :). This was almost a miracle that more than 25 users signed up even after almost everyone missed the pre-requisite instructions that I had mentioned before the event. This has been a trend for all workshop that happened, participants did not go through the pre-requisite for none of them. It's very difficult to conduct code lab if the majority of the time goes on setting up!

Ok, enough about me. This time I also got an opportunity to contribute to the organizing team of the event. I was overwhelmed by the energy and passion that I saw in other organizers and volunteers (some of them were just new faces and contributing for the first time). The team really pulled off some amazing sponsorship and pretty much everything went as per plan if not better.

One challenge that has been always there is the fact that not all registrations could not be accomodated in the event. More than 1800 registrations were received but only 600 could be acceopted due to space contraint. It could really be unfortunate for people who wanted to be part of the event and community in general. But this event is not everything what GDG Hdyerabad community is all about. I really encourage people to watch out for GDG and GCDC meetups that happens all through the year.  Also subscribe to GDG and GCDC facebook and GDG, GCDC twitter handles for any related announcements and collaberate and network with other developers. See you next time.

Sunday, October 7, 2018

PyCon India 2018 Day 2

This post is a continuation of the post I wrote after the end of the first day. The 2nd day started with the keynote from Travis Oliphant who is well known for Python projects like NumPy, SciPy, Anaconda and many more popular libraries. It was one of the best keynotes I have heard in recent times. It not only had technical aspects of Python language development but also a lot if important challenges developers face as a human being. Starting from work-life balance to disagreements on mailing lists over decisions on python language. He gave a lot of insights and hope that anyone literally any one can contribute to the open source projects from his personal examples. The thing which stood out in his keynote was that unlike many other speakers he gave examples from real life events on every abstract point that he mentioned. His keynote motivated me a lot especially to write more, read more and communicate more as a developer.

The session by Anand S on cleaning up data was on.e of the best non-keynote session that I attended here. He seemed to be quite an experience speaker and the topic was quite interesting especially how they de-duplicated the constituency data all the way from 1951 since the first general election.

The conference of ended with an excellent keynote by Carol Willing, who has stunning 41 years of coding experience. She touched upon a lot of good attitudes that a developer should have in general and especially while contributing to Python community projects for a brighter future of Python language.

Overall it was a very well organized event at the best conference facility in the city. Thanks a lot for speakers for traveling all the way here to speak and of course goodies from sponsors (I don't have to buy T-shirts for the next 2 years :) ).

Lastly a great thanks to GDG Hyd and Google Developers for having me in this conference,, it was fun and enlightening.

Next, I am looking forward to Devfest 2018 by GDG Hyderabad on 27 and 28th of October. See you there.

Saturday, October 6, 2018

PyCon India 2018 Day 1

It has been a while I have gone to a tech conference. I had been to JavaOne, Google Devfest (even when I am not speaking)  and also reported on some of them. The report posts were mostly notes on the things I had learned, for me being able to refer at a later point of time.

Last year PyCon India was in New Delhi, some of my colleagues who worked on Data Science and Python Microservices had been there. I got mixed feedback from them. Some said sessions and workshops were very basic i.e. beginners level and some said topics were too specific and deep to be able to grasp at runtime during a conference.

This year it was the 10th year of the conference and held at my own city Hyderabad. It has been quite sometime I have been working on Python-based projects and running them in production also, so there was no excuse to miss that.

I did not really get a chance to attend the workshops but got a chance to represent Google Developer Community on the conference day.

Day 1

The day started with a keynote from Armin Ronacher who is better known as the author of Flask. He talked about current flaws in the Python ecosystem and how other communities like Rust learned from these problems and approached in a different way to fix them. He was really vocal about what he thinks would be a perfect future roadmap of Python as a language and its community.

There were several interesting talks in all 3 tracks after that. I enjoyed the talk by Abhijit Gadgil who spoke about python project workflows. It was quite basic but very important in my opinion because hobby developers, teams, startups tend to ignore complete workflow settings when things run and they see the output. From a maintainability standpoint its extremely important invest in workflows from configuring source control to linting. This helps in increasing productivity in long run.

There were several lightning talks by various communities and organizations.

Last but not the least it was great meeting fellow GDG community members, folks from AQR (Creators of Python Pandas ), Zauba Cloud, GOJEK and the organizers (Including the chair of PyCon India himself ) of PyCon India itself.

 Looking forward to Day 2.

Monday, September 24, 2018

Ikea Hyderabad

Ikea opened their operations in Hyderabad last month and there has been a craze in the city people about it since then.  A lot of videos were circulated showing uncontrollable crowed pushing each other at the entrance of the store when it first opened. I am sure there were a lot of people just wanted to go once just to see what is it all about and later go only when you want to buy something.

It has been a month and my friends told me the crowd has been reduced lot. So I decided to go. Their home page showed there was no waiting time at the entrance. There is a lot of parking in the store itself which is not really advertised and on a Sunday morning, it was really empty.

Ikea in Hyderabad is also quite famous for its affordable food in the restaurant so we gave it a shot. I was really surprised to see it was truly self-service i.e. you pick up food items and bill only at the end just before finding a table. I have not seen this in India.

Then we visited the furniture section which is quite large for small items you pick up on the spot and put in a trolly or a yellow  shopping bag and for large items like furniture which needs assembly you can just note down the item number in the Ikea mobile app and later at the end you pick up the parts at the specific rack and location in the warehouse, the item I bought was quite large so I had to take a special trolly so that the planks of my furniture could fit. I also had to fold the back seat if my car to fit it in. Back home I found the tools provided by Ikea inside the package was sufficient. Also, Ikea gave all screws and bits exactly in the required number so if something is left out you probably missed to use it somewhere.

Delivery charges were expensive and I know now what can fit in my car so I'll probably go back there soon to pick up some more stuff.