# gRPC/http2 requests from a plugin

**URL:** <https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982>\
**Category:** Questions\
**Created:** [August 25, 2020, 7:07pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982 "2020-08-25T19:07:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishekvrshny](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/abhishekvrshny/32/1613_2.png) [@Abhishekvrshny](https://discuss.konghq.com/u/Abhishekvrshny)\
**Post date:** [August 25, 2020, 7:07pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/1 "2020-08-25T19:07:56Z")

</div>

Is it possible to make gRPC or http2 calls from within a plugin? I could not find any stable/recent packages for the same. Although there is one for protobuf [https://github.com/starwing/lua-protobuf](https://github.com/starwing/lua-protobuf) , but `luasocket` doesn’t seem to have any documented support for http2.

---

<div class="post-metadata">

**Author:** ![jeremyjpj0916](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/jeremyjpj0916/32/1388_2.png) [@jeremyjpj0916](https://discuss.konghq.com/u/jeremyjpj0916)\
**Post date:** [August 25, 2020, 9:09pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/2 "2020-08-25T21:09:41Z")

</div>

Seems half baked here: [https://github.com/tokers/lua-resty-http2](https://github.com/tokers/lua-resty-http2) , no tls too. Also reading the openresty git issues seems like there is still some work to do around native http2 support.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [August 27, 2020, 10:56pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/3 "2020-08-27T22:56:31Z")

</div>

This is not possible yet. We had started work internally to get this going but that work was halted due to other issues.

@Abhishekvrshny What is your use case (curious)?

---

<div class="post-metadata">

**Author:** ![Abhishekvrshny](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/abhishekvrshny/32/1613_2.png) [@Abhishekvrshny](https://discuss.konghq.com/u/Abhishekvrshny)\
**Post date:** [August 29, 2020, 8:22am UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/4 "2020-08-29T08:22:47Z")

</div>

@hbagdi In our setup, we have written a bunch of plugins for various functionalities. While most of the plugins use Kong’s dao layer and thus also get benefitted from entity cache. There are some plugins, where we may not want to persist the state in kong but rather use a standalone service to which these plugins can make a call to get the required data/state. gRPC or http2 would help in these remote calls being fast and not add up to kong’s proxy latency.  
Would you be able to point me to any discussion or draft PR for this support? I would be happy to contribute if I can 🙂

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [August 31, 2020, 5:21pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/5 "2020-08-31T17:21:54Z")

</div>

> [@Abhishekvrshny](#):
>
> Would you be able to point me to any discussion or draft PR for this support? I would be happy to contribute if I can 🙂

I doubt we have anything. @hisham, @bungle, @salazar or @xguru might have more details if there is anything. From what I understand, this is a pretty large engineering lift to create a solution that doesn’t kill Kong’s performance.

> [@Abhishekvrshny](#):
>
> gRPC or http2 would help in these remote calls being fast and not add up to kong’s proxy latency.

While I don’t know what is your performance profile, have you tried using HTTP/1.1 for your solution? OpenResty plugs in to Nginx’s event loop so all requests are asynchronous and shouldn’t affect your latencies considerably. You will spend more time in JSON/HTTP message marshaling/unmarshalling but the overheads are usually small enough for most use cases.

---

<div class="post-metadata">

**Author:** ![Abhishekvrshny](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/abhishekvrshny/32/1613_2.png) [@Abhishekvrshny](https://discuss.konghq.com/u/Abhishekvrshny)\
**Post date:** [August 31, 2020, 7:56pm UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/6 "2020-08-31T19:56:35Z")

</div>

> have you tried using HTTP/1.1 for your solution

Not yet. The performance tests are pending. I was trying to explore all possible options. One caveat that we have is we make even internal calls over SSL and SSL handshake tends to add significant latency. I’ll try HTTP/1.1 with `keepalive` and see if that meets our requirements. I’ll keep the thread posted.

Also, on a related note, is there a way to have `keepalive` connections to Cassandra? [Keepalive connections in cassandra connector](https://discuss.konghq.com/t/keepalive-connections-in-cassandra-connector/6646)

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [September 1, 2020, 3:14am UTC](https://discuss.konghq.com/t/grpc-http2-requests-from-a-plugin/6982/7 "2020-09-01T03:14:40Z")

</div>

> [@Abhishekvrshny](#):
>
> is we make even internal calls over SSL and SSL handshake tends to add significant latency. I’ll try HTTP/1.1 with `keepalive` and see if that meets our requirements.

It should.

> [@Abhishekvrshny](#):
>
> Also, on a related note, is there a way to have `keepalive` connections to Cassandra? [Keepalive connections in cassandra connector](https://discuss.konghq.com/t/keepalive-connections-in-cassandra-connector/6646)

I do not know that. @thibaultcha or @bungle knows the most in this area.
