In previous posts, we’ve talked a lot about all the capabilities of Flogo and how to do different kind of things with Flogo, and one message was always underline there: performance, performance, performance… but how performance is Flogo compared with other modern programming languages?
To be able to share some real data the best thing we can do is to do our test. To do our test we’re going to compare our Flogo development versus the same one using Python.
You could ask why we’re comparing it Flogo developments and Python developments and the answer is very simple. Python is now one of the most trending languages, recently added as the 3rd top language in the TIOBE Index and the main language when we talked about data science scripting:
We’d like to test both technologies but also see how they compared with the new reality for microservices and be able to integrate with Cloud Services and we think then best fit for this test will be using Amazon S3 to be able to see how this both technologies performs.
So, we’re going to upload files to Amazon S3 and see how both technologies perform. And we select the following tests:
- File A: small 138 KB. Number of iterations, 1, 10, 50.
- File B medium 7 MB. Number of iterations 1, 10, 50.
- File C: big 50MB. Number of iterations 1, 10, 50.
We’re using the following Python script for test the S3 integration:
from botocore.exceptions import NoCredentialsError
ACCESS_KEY = 'XXXXXXXXXXXXXXXXX'
SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
def upload_to_aws(local_file, bucket, s3_file):
s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY,
s3.upload_file(local_file, bucket, s3_file)
print("The file was not found")
print("Credentials not available")
start = time.time()
for x in range(0, int(sys.argv)):
uploaded = upload_to_aws('D:/Data/Downloads/export.sql', 'testflogovspython', 'export.sql')
end = time.time()
print("Time: " + str(end - start))
And we’re going to use the following Flogo Application (several flows for each of cases we’d like to check)
Now, as this is going to be to build microservices or applications in a cloud world let’s see how both perform doing a simple Hello World REST API. For the python part we’re going to use Flask to create the web service and the following snippet:
from flask import Flask
app = Flask(__name__)
return "Hello World!"
if __name__ == '__main__':
NOTE: We keep the debug=True to make it equivalent to the INFO default level system in Flogo Application
And for Flogo a simple REST Hello World like this:
Results and Conclusions
We’re getting the following numbers as you can see in the graph below:
Even in this quite simple code sample, the performance of the Flogo application is too incredible to be compared with another well-performed language like Python.
We’re talking like an average of more than 50% faster the Flogo development vs the Python one, and even more when the size of the file is small and more important is how the language and the platforms are handling things because they percentage of time regarding bandwidth is not big enough to make that all the values depend on the connection you have available at that moment.
If we talk about memory consumptions data are pretty much stable for both languages what is a very good sign on how memory is handled for those platforms. But in this battle also Flogo wins because if we use the last one the biggest one, Flogo is stable at 22,7 MB vs 55 MB from Python, also more than 50% better once again.
For the REST API service results are pretty similar to the ones from the first TEST, and we’re seeing the following results regarding TPS and Response time:
As we can see first of all the response time is always smaller from the Flogo API (and remember that this is a default test, with no special tuning or something similar) and also the response time is performing better in Flogo being able to keep stable almost until 4 threads and then being able to control the increase while Python REST service after 2 threads the response time increase more than twice with each test.
The same thing happens regarding TPS wherein the Flogo case all the values are better than the previous one. Of course, some kind of limit is reached at 8 threads but in the case of Python this root is reached at 2 threads and after that point all the values and worse than the previous one.
Regarding memory, consumption is pretty similar like the previous test both of the solutions keep memory usage quite low and stable. In this case, python is always stable at 20.3 MB and Flogo starts at 15 MB but reaches its peak at 21.8 and then go back to 18.8 MB. So as I said they’re pretty similar regarding memory usage in this test
So, the conclusion is clear, no matter how well you think your logic is executing in Python, you should give it a try to do it using Flogo because, in this time where each MB and each msec counts to make smaller your Infrastructure bill, Flogo is going to be your best tool to squeeze all the power of your infrastructure.
You can find all the code I’ve used for these tests in the GitHub repository shown below: