The right to privacy

Privacy on the internet never been a big concern for me. But recently, I dropped the "Nothing to hide" argument.

It all started with me noticing some ads related to things that I never discussed publicly but instead discussed with friends using WhatsApp. That made me grow some awareness that even though Facebook says all messages are encrypted while in transport, they are still able to read the messages in your device. Later on, I also had a blast reading the article about Jan Koum leaving Facebook.

It does not end with Facebook, Google has been in a lot of scandals around privacy, and there are some great discussions about how Google created a "filter bubble" problem. Which, in simple terms, is how Google manipulates our search results based on individual data.

Personal data today is power, and as everyone knows, power usually corrupts. Now imagine having an unfiltered stream of data from almost every internet user in the world.

Ok, I get it, so now what? WTF can I do?

That's what I kept thinking for some time, then I decided to take action, and today I believe I'm in a better place regarding my privacy.

The first thing I have done was to try my best to move away from Google, starting with the search engine. It may sound crazy, but it's the easiest change, DuckDuckGo is a fantastic search engine, and they are pretty heavy on privacy. They also maintain an excellent blog that contains a lot of information about privacy on the web.

Changing search engines was easy. Changing email provider was the most arduous task. I had to move from Gmail because not leaving it would make all my efforts of stop using Chrome, stop signing up to services using my Google account, and etc., be kind of nulled out if Google kept the ability to read all my emails. So it was settled, I had to leave Gmail.

I've tried out a few email providers, paid a month for some of them, but  I did not have a pleasant experience because the most secure ones make necessary to use their own mobile app or companion OS app to decrypt/encrypt emails. The reason for that is how email is insecure by definition. Anyway, to cut a long story short, I'm currently using FastMail and iCloud Mail. FastMail is where I receive all emails from my domains, and well, my @me.com address became my personal email once again.

This search for more privacy led me to a few nights arriving home, and instead of watching Netflix, I was doing researches and moving away from services that clearly consume and sell my data. Also, securing my home network became a priority, which led me to buy a new fancy router, so all my devices would be connected to my VPN provider. Properly configuring all my devices to more privacy oriented settings also cost me a lot of research time.

It's not an easy task, I know. It will probably take you a few days, and a lot of planning to get rid of these services that you use so much and sometimes can't even think that you can live without them. But it is possible.

via GIPHY

Discussion

Goodbye, Globo.com.​ It was a great ride!

My last day at Globo.com will be Monday, August, 8.

Right now we’re in the countdown to the Olympic Games. We’ve accomplished a lot in this last year. We’ve worked hard on the Live Architecture so we could have one fantastic Olympic Games coverage.

One of the first changes we’d agreed to make about a year ago was to scale the Live API, which one of the main routes give’s the playable URL to the user, taking into consideration his latitude and longitude to provide him with the correct stream. Using Ruby, we were relying on the MySQL Geometry Functions to do all the work. Since Alexandre Martins and I had a lot of experience with Scala, we chose to create a POC using Scala with Finagle and present to the team. Result: We started to do all the calculations in memory, because of these changes on our benchmarks we’ve jumped from ~450 requests per second to ~3,000 requests per second in a single unit, the response time dropped from 80–100 ms to <15 ms and we also made it amazingly fault tolerant. We also started counting on Tsuru (A Docker-based Platform as a Service (PaaS) built inside Globo) for auto-scale and Blue-Green Deployment.

When we concluded this first step, we had to scale up a surprising number of other systems and our Cassandra Cluster.

After all these changes, we needed events with a high number of viewers to test our throughput and see if our changes would cause any collateral damage. The political crises which heated up in March 2016, helped us to overcome our worries since we had transmissions with more than 400,000 viewers. Our changes to the architecture prove to have a significant positive impact on Live video delivery.

And now the Olympic Games have begun. We’re euphoric with everything we have done and feeling accomplished with the results.

But now, It’s time to say goodbye. I had an incredible time with all of you.

Discussion

A simple Http Service using Java and Finagle

Finagle has always been my top choice to build all my Scala projects, it has an incredible ecosystem and is maintained by awesome people.

Not long ago I had to build a POC using Java, and I chose to give Finagle a try for the first time in one of my Java projects,  boy I struggled 😂, the lack of documentation and the verboseness of using Scala APIs in Java made me struggle a good amount. Later I decided to contribute with an example of HTTP service in java; https://github.com/twitter/finagle/pull/470 and it also gave me the idea to write this blog post.

On this post, I will try to explain some of the basic Finagle concepts while demonstrating how to use them using Java gists.

Cool! But... what is Finagle?

Finagle is a protocol-agnostic, asynchronous RPC system for the JVM and we are able to use it with any JVM-hosted language. By @TwitterEng.

Now that we got rid of the basic definition, let's see how to create a simple service in Java with Finagle.

A minimal HTTP server

Creating a server is pretty straightforward, the serve method takes an address of type SocketAddress and a service. For routing, we are using the HttpMuxer class from com.twitter.finagle.http which is a service that dispatches incoming requests to registered handlers.

Filters

Filters are mainly used to define application-agnostic behaviors, as for adding a timeout to services, rescuing exceptions and transforming into expected HTTP results and etc. Services and filters are the core abstraction that clients and servers are created using Finagle.

Let's go ahead and create a filter that handles Exceptions being thrown from our service, and map then to HTTP status codes, after all, we don't want stack traces leaking out, right? 😉

As you can see we use the Future.handle() function takes a PartialFunction whose responsibility is to transform our exception into our HTTP response with the correct status code. BTW, I chose to use the ExceptionalFunction type from com.twitter.util to allow us throwing checked exceptions.
Now let's go ahead and create our service that will handle the request when we do an HTTP call to /cat.

In general, we should always use Future.exception(), however for the sake of this example we will just throw the exception.

Now we just need to wrap everything together. We will have our service throwing  NumberFormatException when we fail to parse the param id as a number, and our filter transforming that result in a valid HTTP status code as BAD_REQUEST.

Filters and Services

For composing our service with our exception filter we use the andThen method, that produces a new Service composed from our service and our HandleErrorsFilter.

That concludes our post, see you soon!

Discussion