Coder Social home page Coder Social logo

Comments (2)

lizzzcai avatar lizzzcai commented on May 31, 2024 2

Building from dockerfile is a nice feature and it can provide more flexibility to users.

The current build from source is not so optimized. I tried to build the same hello world program, one is from source and another is from dockerfile. For image built from dockerfile, the image size is about 1.9MB. For image built from source, the size is about 260MB. Hopefully, it can be optimized in the future.

A side topic, I want to check if OpenFunction can support customized run image. The target here is to reduce the image size so that can reduce the cool start time.

Usecase:
for machine learning use cases, there are usually a lot of dependencies like tensorflow, pytorch, opencv etc. The size of these kinds of libraries are quite big (up to 1-2 GB usually) and the actual code is about 1-2 MB (not including the models). If the base libraries can be separated and cached in the host machine, I think that will help to reduce the cool start time.

A similar result is shown in this post for your reference.

An example function yaml:

apiVersion: core.openfunction.io/v1alpha2
kind: Function
metadata:
  name: iris-python
spec:
  version: "v1.0.0"
  image: "lizzzcai/iris-python-func:v0.4.0"
  imageCredentials:
    name: push-secret
  port: 8080
  runImage: tensorflow/tensorflow:2.2.3-py3 # dependencies to run the python code
  build:
    builder: openfunction/builder:v1
    env:
      FUNC_NAME: "predict"
      FUNC_TYPE: "http"
      FUNC_SRC: "main.py"
    srcRepo:
      url: "https://github.com/lizzzcai/openfunction-samples.git"
      sourceSubPath: "iris-python"
  serving:
    runtime: Knative

I can create a feature request for this if needed. Thanks.

from openfunction.

benjaminhuo avatar benjaminhuo commented on May 31, 2024

@lizzzcai Thanks for the suggestion!
I think there're two problems here:

  1. Optimize the image created by cloud-native buildpacks approach to reduce image size
  2. A method to preload the run image to nodes to reduce the cold start time

You're welcome to create an issue for this!

from openfunction.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.