Skip to main content

Posts

Showing posts from 2014

Can you remain a fullstack developer?

I started as a full stack developer 14 years ago but these days its becoming more and more difficult to remain a one. Back in those days all you needed to know was html/css/Js/jsp/java/sql/ant/xml and some tools like tomcat, svn, eclipse and some shell scripting and you are a full stack developer. Being full stack developer means you can code from UI layer to server to database and peel any layer of onion to trace an issue.

Now a days you may need to know 20 different technologies in each area before you can easily navigate between layers. Life becomes difficult if its a distributed system. In UI you may need to know
ReactAngularJquerySASSHTML5JavascriptNode.jsGrunt and many more In server you need to know
JavaSpringHibernate or any OR toolGuavaNginxHaproxyMemcached and many more.  In Database you may need to know
MysqlNOSQL databases like Cassandra or MongoDBShardingAWS Aurora or RDSElasticSearchRedisOpenTSDBHadoop Big data services like BigQuery and many more On top of that …

Saas Applications and Manuals?

Software Manuals anyone? Who reads them?  For interactive products like Video games or phones, who reads them?  My 4 year son started using iPad like a pro and now he even tells me this is PBS kids and this is netflix.  When I got an iPhone I never read a manual and havent so far for last 2 years.  As Kids we never read manual for video games. The game developers just made level1 easier and you learn as you play and get better.

Recently I had a chance to compare two APM tools AppDynamics and NewRelic at a large scale at my employer and both took me 5 min to setup and get going. But what sold me to NewRelic was their ability to deliver value without doing any additional configuration. Their Level1 itself had so many aha moments that it sold me immediately.  Dont get me wrong, Appdynamics is a very  powerful APM tool but you have to configure it, tweak it like an ERP solution to get value out of it, it felt so 1990s. In past 3 months I never got enough time to tweak and configure Appdyn…

War epics and strategies

I am a big fan of War Epics, but not the recent wars. I am more interested in ancient wars.  It seems there aren’t any ancient war movies from US or UK culture that I liked except movie 300 or the Gladiator

For Indian war epics I recommend Ramayana and Mahabharat  but I don’t see that many war strategies in the series.

Anyone interested in real war strategies and have patience should definitely watch this series(80+ Episodes, I am at 40th right now ) War of the Three Kingdoms
and if you want to see it in short then you can watch the Red Cliff movie but it doesnt do justice so for the patient watch the series, its free on youtube.



And you thought Memcached calls are cheap?

We use Memcached as a distributed cache. We also use sharding in MySQL and each customer data is on different shard. The information about which customer is stored on what shard is static and doesn’t change unless we do a manual customer move.  Because we would do an automatic move a customer in future I started storing this in memcached instead of JVM so I don’t need to coordinate in memory cache flush across multiple boxes.

We recently moved a large scale system from python to Java and we were getting close to 2K request per minute on every machine. On checking APM tool I found that a lot of the time is spent in memcached.getObject. Checking one of the memcached box out of many I would found CPU on one of the cores would be pegged at 100%.  I installed  mctop by Etsy and found that the most used key was the key that would lookup this customer is on what shard

sudo /opt/mctop/bin/mctop --interface=eth0 --port=23456 


Inspecting all other data centres showed similar symptoms. So I add…

Recharge brain by Walking in afternoon and no meeting days?

Mornings are precious to me as my brain is most active in morning but I have now 5 members in team and I daily get tons of emails to reply. After replying to emails and doing calls after 2 or so the brain was getting exhausted and I was procrastinating to pick up large tasks.  Also part of the problem was after eating meal I was feeling sleepy too. Drinking coffee wasnt helping beyond 3 or so.  I work from home so there is always this lure to take a nap but then I would feel guilty. So I started
No meeting days on Wednesday/FridayWalking 20 min after lunch in afternoon No meeting days means I get an extra 2 hours in week. I also think no meeting days on Wed/Friday is good for the team also, as earlier I would do 1 hour call with 5 members and that would mean close to 10 hours of time. Now team can get 10 extra hours for working and they need not worry about the Manager vs Maker schedule on 2 days.  Of-course if they want to talk to me they can always call me.

Walking 20 min after lunc…

Junit Expected Exception checking Part2

It seems in my previous post the way I was sending error response was not the way UI was expecting it so I had to refactor code and used hibernate validator but it posed some issues in exception validation.

The code in REST api changed to

    public Response search(@Context User user, FolderSearchRequest folderSearchRequest) throws ApplicationException {

        Set<ConstraintViolation<FolderSearchRequest>> violationResult = validator.validate(folderSearchRequest);
        if (!violationResult.isEmpty()) {
            Set<ConstraintViolation<?>> violations = new HashSet<ConstraintViolation<?>>(violationResult);
            throw new ValidationException(violations);
        }

and the pojo changed to

@Data
@AllArgsConstructor
@NoArgsConstructor
public class FolderSearchRequest {
    public static final Integer DEFAULT_LIMIT = 30;
    public static final Integer DEFAULT_OFFSET = 0;
    @NotBlank
    @Size(min = 3)
    private String query;

    @Range(min = 0)
    pri…

Junit Expected Exception checking

I was writing a temporary REST api for folder search until the elasticsearch based api is live. The api has some validation code and I was trying to test it.

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response search(@Context User user, FolderSearchRequest folderSearchRequest) throws ApplicationException {
        if (StringUtils.length(folderSearchRequest.getQuery()) < 3) {
            throw new GenericRestServiceException(ErrorCode.FailedValidation, INVALID_QUERY_MSG);
        }
        if (folderSearchRequest.getStart() < 0) {
            throw new GenericRestServiceException(ErrorCode.FailedValidation,
                    INVALID_START_MESSAGE);
        }
        if (folderSearchRequest.getLimit() <= 0) {
            throw new GenericRestServiceException(ErrorCode.FailedValidation,
                    INVALID_LIMIT_MESSAGE);
        }

At first I was writing code like

    @Test(expected=GenericRestServiceExcepti…