Saturday, December 24, 2016

Py CPU Score

What is your Py CPU score?

You are probably asking what "Py CPU Score" is.

I am giving the following simple CPU test the name of Py CPU Score. It uses 2 lines of Python code to determine how fast your CPU is.

Python code for Py CPU Score:
import timeit
int(round(timeit.timeit('"|".join(str(i) for i in range(99999))', number=1000), 0))

This simple code can be used to measure the CPU performance of your computer in a very simple way.

Here are Py CPU Scores for some of my computers:

  • 31 sec ==> Macbook Air 13", 1.6 GHz Intel Core i5, 4Gb memory, OS X El Captain
  • 26 sec ==> Dell Inspiron 1.80 GHz, 2 cores, 8Gb memory, Windows 7 64-bit. 
  • 22 sec ==> Dell Latitude E6540, i7-4810MQ, 2.80 GHz, 16Gb memory, Windows 7 64-bit.

If you are familiar with Python code and you are wondering what this code does, here is a quick explanation:

  • It loops from 0 to 99,998 and appends these numbers to a string that has a separator. That's one unit work and it repeats this unit of work 1,000 times and it calculates how many seconds it took to perform that. 

To establish a good baseline, execute this code when your computer is not doing anything else. Depending on what type of computer you have, you may notice a significant increase in CPU utilization. If you ran around 10 of these Python scripts in parallel, your CPU could approach 100% very quickly. 

Try it out. Comment below with your score and the specs of your computer. 

Almir M.

Friday, December 16, 2016

Troubleshooting Http 504 error  in AWS — some quick tips

- Go to EC2
- scroll down to Load Balancers
- select your LB
THEN look down and SET Idle Timeout. Since ELB may pre-open connections, the timeout of 60sec may not be enough because they may expire by the time ELB tries to use the connection to get to your service.
ALSO check the KeepAliveTimeout on your web server and it should be greater than or equal to Idle Timeout on your ELB.

Almir M.
#aws #ELB #code #programming #API #RESTful 

Sunday, December 11, 2016

Should Senior Leaders be diving into technical details?

Should your senior leadership team be diving into technical details?
A lot of times people say that your thought process and idea-generating part of brain will be subconsciously limited or throttled down if you get into the low-level technical details that your job does not require. Yes, there is something to be extrapolated out of this, but this is not entirely true.
Let’s use product managers/owners as an example. Nobody should be stopping you from dreaming and coming up with requirements and direction that may not look closely feasible. That’s ok; this exercise is definitely needed and that’s how a lot of great ideas were kick-started; however, kick-starting an idea is not enough. Sometimes you are required to come up with something that is a short to mid-term dream but very feasible and in order to achieve that, as the product manager you would need to understand the low-level technical details.
The same applies to our senior leaders. As a leader you need to be occasionally diving deep, figuring things out and coaching your team, and then surfacing to the top and making executive decisions.
This reminds me a bit of the show “Under the cover boss”. It should not happen as it happens in that show, but you understand my point. The bosses that roll up their sleeves when necessary create an open culture that allows employees to relate to them better and feel more open to share the information. I have been in a number of situations when members of my senior leadership team stayed with me at work in the early morning hours helping me out in the last stretch of critical projects. I even remember the 24–30 hour shifts when we got support from leaders several levels above us. They were there to listen, to understand and provide input when needed.
Going back to the original question. Should these senior leaders be diving into technical details when necessary? There is no right or wrong answer but in my personal experience, I appreciated the technical and moral support from the senior leadership team in the 11th hour of our projects.
Almir M.

Friday, December 9, 2016

DynamoDB Costs — Provisioned per second and cost per month

As you know AWS DynamoDB tables require read and write provisioning. You need to figure out how many reads/sec and how many writes/sec each table will need and then you provision it. You should do the same thing for your GSIs.
Keep in mind the provisioning numbers are read & writes per second and the cost is calculated per month.
Here is a quick reference for the cost based on different provisioning numbers:

Almir M.