fn project hot functions 说明
所谓 hot functions 实际上就是长时间运行的functions ,简单理解类似后台任务
fnproject 使用 类似 http的处理方式
package main
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
)
func main() {
for {
res := http.Response{
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
StatusCode: 200,
Status: "OK",
}
r := bufio.NewReader(os.Stdin)
req, err := http.ReadRequest(r)
var buf bytes.Buffer
if err != nil {
res.StatusCode = 500
res.Status = http.StatusText(res.StatusCode)
fmt.Fprintln(&buf, err)
} else {
l, _ := strconv.Atoi(req.Header.Get("Content-Length"))
p := make([]byte, l)
r.Read(p)
fmt.Fprintf(&buf, "Hello %s\n", p)
for k, vs := range req.Header {
fmt.Fprintf(&buf, "ENV: %s %#v\n", k, vs)
}
}
res.Body = ioutil.NopCloser(&buf)
res.ContentLength = int64(buf.Len())
res.Write(os.Stdout)
}
}
format (mandatory) either "default" or "http". If "http", then it is a hot function.
idle_timeout (optional) - idle timeout (in seconds) before function termination, default 30 seconds.
https://github.com/fnproject/fn/tree/master/examples/tutorial/hotfunctions
https://github.com/fnproject/fn/blob/master/docs/hot-functions.md
fn project hot functions 说明的更多相关文章
- fn project AWS Lambda 格式 functions
Creating Lambda Functions Creating Lambda functions is not much different than using regular funct ...
- fn project 扩展
目前支持的扩展方式 Listeners - listen to API events such as a route getting updated and react accordingly. ...
- fn project 生产环境使用
此为官方的参考说明 Running Fn in Production The QuickStart guide is intended to quickly get started and kic ...
- fn project 对象模型
Applications At the root of everything are applications. In fn, an application is essentially a grou ...
- fn project Function files 说明
主要是文件 func.yaml func.json 详细说明如下: An example of a function file: name: fnproject/hello version: 0.0. ...
- fn project k8s 集成
具体部署还是比较简单的,以下为官方参考,只是有一个service type 为 loadBlancer 实际使用需要修改为NodePort Prerequisite 1: working Kuber ...
- fn project 私有镜像发布
1. 说明 fnproject 默认的docker registry 是 dockerhub 对于企业应用还是不太方便的 还好系统系统了配置参数方便我们进行配置,与开源harbor 进行集成 2. 使 ...
- fn project 数据库配置
Databases We currently support the following databases and they are passed in via the DB_URL environ ...
- fn project faas 框架试用
1. 预备环境 docker 17.05 docker hub account (测试可选) 2. 安装 curl -LSs https://raw.githubusercontent.com/fnp ...
随机推荐
- JAVA基础补漏--static
静态方法不能访问非静态变量的原因 静态的方法和变量在内存中先产生,非静态的后产生,在静态调用时非静态可能还未创建,所以会发生错误,故不能访问. static的内存图 静态代码块 static { Sy ...
- quartz(8)--其他
JOB并发执行 Quartz定时任务默认都是并发执行的,不会等待上一次任务执行完毕,只要间隔时间到就会执行, 如果定时任执行太长,会长时间占用资源,导致其它任务堵塞. 设置为非并发 1)Job类加上注 ...
- 有关写log的思考
前言 在软件开发过程中,log往往是不太引人注意的环节,大部分的log都只是开发人员为了调试bug临时加上的.这样出来的软件,最后的log往往杂乱无章没有系统性.我们判断一个软件系统的log写的好不好 ...
- Jar 包 及运行Jar包 - 转载
Eclipse的jar file和Runnable JAR file的区别 - 及bat运行Runnable JAR文件 1.两种jar的区别 jar file是最普通的jar包,即平时我们工程中li ...
- 有谁知道什么工具测试IOS手机上APP的性能软件啊?
有谁知道什么工具测试IOS手机上APP的性能软件啊?
- 探秘DPDK Virtio的不同路径
什么是Vhost/Virtio Vhost/Virtio是一种半虚拟化的设备抽象接口规范, 在Qemu和KVM中的得到了广泛的应用,在客户机操作系统中实现的前端驱动程序一般直接叫Virtio, 在宿主 ...
- neutron dhcp ha 实验
4个节点(controller, network,2 compute nodes) 1.0 on the network node 1.1 set –I ‘s/start] on/#start\ ...
- Android开发——View的生命周期总结
0.前言 今天看到一个概念是View的生命周期,有点懵逼,听说过Activity的生命周期,Fragment的生命周期,对View的生命周期好像没什么概念啊.难道layout.draw这些也算是生命周 ...
- css类名大全以及其他关键词
标签 abbr 缩写的标记 token-based-auth-backend 后端 token-based-auth-frontend 前端 signin 登陆 Sign in / Sign u ...
- Entity Framework 6:专家版本
随着 Entity Framework 最新主版本 EF6 的推出,Microsoft 对象关系映射 (ORM) 工具达到了新的专业高度,与久负盛名的 .NET ORM 工具相比已不再是门外汉. EF ...