Saturday, February 17, 2024

🔥Mojo faster than Rust language!

Mojo is a new language, a superset of Python, with a toolset for optimizing performance.
In particular it is intended to speed up AI/ML payloads, on diverse computing hardware.

Rust is a relatively new language designed to provide performance of C++ with safety. 

The interesting part is that both of those languages are using same LLVM compiler platform created by creator of Mojo language, Chris Lattner. So at least "in theory" it is possible that Mojo could end up with comparable, or better performance, with very readable and relatively easy to learn syntax of Python. 

With a great team, and $100M funded startup, that is very promising.

Modular: Community Spotlight: Outperforming Rust ⚙️ DNA sequence parsing benchmarks by 50% with Mojo 🔥

100x benchmark improvements over Python, and a 50% improvement over the fastest implementation in Rust.

A look at the Mojo language for bioinformatics


Mojo Is FASTER Than Rust - YouTube


MAX: Modular Accelerated Execution Platform
MAX is an integrated, composable suite of products that simplifies your AI infrastructure so you can develop, deploy, and innovate faster.


Mojo (programming language) - Wikipedia


Mojo 🔥: Programming language for all of AI

Mojo files use the .mojo or .🔥 file extension.





Kubernetes "depends-on" solution

Docker supports "depends_on" feature to define dependency between containers.

Kubernetes deployment is more involved, since it is distributed, and equivalent features in not available directly. 

Instead, there is option to define "initContainers" that can implement logic to check if required services are available before starting the Pod's main container. The "init" could be a custom script with generic mini-shell container, or it could be a dedicated container.

There is also an option to add "annotations" that can help human understanding of dependencies, while not enforced directly by K8s.

What is the equivalent for depends_on in kubernetes - Stack Overflow

spec:
      initContainers:
      - name: wait-for-grafana
        image: darthcabs/tiny-tools:1
        args:
        - /bin/bash
        - -c
        - >
          set -x;
          while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://grafana:3000/login)" != "200" ]]; do 
            echo '.'
            sleep 15;
          done
      containers:
          .
          .
  (your other containers)

Opsfleet/depends-on: Small utility & container to describe dependency relationship between Kubernetes deployments @GitHub (GoLang, MIT)

Kubernetes and Helm don't have a built-in mechanism to deploy pods in a specific order.

Solution: This small container allows you to add an InitContainer hook to all of your deployment YAML files to create a dependency relationship to other services and/or jobs in the same namespace:

initContainers:
- name: wait-for-services
  image: opsfleet/depends-on
  args:
  - "-service=mongodb"
  - "-service=rabbitmq"
  - "-job=myjob"

Declare dependencies between resource objects  |  Config & Policy  |  Google Cloud

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
 
namespace: default
 
labels:
    app: wordpress
 
annotations:
    config.kubernetes.io/depends-on: apps/namespaces/default/StatefulSet/wordpress-mysql

Annotating Kubernetes Services for Humans | Kubernetes

apiVersion: v1
kind: Pod
metadata:
  name: worker
  annotations:
    a8r.io/dependencies: “services: db, redis”