You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by "Eric Friedrich (efriedri)" <ef...@cisco.com> on 2017/02/01 15:44:46 UTC

TS LUA Plugin

I’m looking for thoughts on the TS LUA plugin. After Shu Kit’s awesome talk in Sunnyvale, I’ve been considering bringing it into our ATS config. Initially for simple things like setting/getting Cookies, but eventually more complex tasks as well. 

What are other experiences with TS LUA as far as performance and stability go? 

Any pitfalls to watch out for?

Thanks!
Eric
 

Re: TS LUA Plugin

Posted by Shu Kit Chan <ch...@gmail.com>.
Depending on your actual use, ts.http.id() and ts.process.uuid() may
be enough. Or the library James mentioned should work, too.

Hard to give specific advice on the organization because i think it
depends on lots of factors like teams, projects, etc. But I almost
always require the team to use module and write unit tests. I saw
fancier organization/structure in which there is configuration file
(written in lua) to determine the list of modules/functions to run for
each hook and the ordering of them.

Thanks. Sorry for replying late.

Kit



On Wed, Feb 1, 2017 at 5:29 PM, Eric Friedrich (efriedri)
<ef...@cisco.com> wrote:
> Thanks Kit-
>   One top level question, maybe more directed at use of LUA is how to generate a unique ID or number inside of a plugin. I’ve checked the docs and don’t see any C++ bindings from TS exposed that would help, so it looks like its left to the LUA math library or using some value from the ts.client_request.
>
> Does that sound right?
>
> Also, if you have advice on specific tips for organizing scripts (1 hook per file or something like that) I would appreciate hearing it
>
> —Eric
>
>> On Feb 1, 2017, at 2:41 PM, Shu Kit Chan <ch...@gmail.com> wrote:
>>
>> Please feel free to ping me or the dev mailing list for questions on
>> the ts- lua plugin
>>
>> It is very good and easy for making quick fixes to manipulate headers
>> and target origin url.
>> Performance is ok and it is quite stable and I think lots of people
>> are using it in production.
>>
>> For more complicated tasks, my recommendation is to try to plan ahead
>> in terms of organization and structure of your scripts. I find that
>> making it easy invites more people to try your stuff. But without a
>> good plan for your team, it can get messy very quickly.
>>
>> Thanks.
>>
>> Kit
>>
>>
>> On Wed, Feb 1, 2017 at 7:44 AM, Eric Friedrich (efriedri)
>> <ef...@cisco.com> wrote:
>>> I’m looking for thoughts on the TS LUA plugin. After Shu Kit’s awesome talk in Sunnyvale, I’ve been considering bringing it into our ATS config. Initially for simple things like setting/getting Cookies, but eventually more complex tasks as well.
>>>
>>> What are other experiences with TS LUA as far as performance and stability go?
>>>
>>> Any pitfalls to watch out for?
>>>
>>> Thanks!
>>> Eric
>>>
>

Re: TS LUA Plugin

Posted by James Peach <jp...@apache.org>.
> On Feb 1, 2017, at 5:29 PM, Eric Friedrich (efriedri) <ef...@cisco.com> wrote:
> 
> Thanks Kit-
>  One top level question, maybe more directed at use of LUA is how to generate a unique ID or number inside of a plugin. I’ve checked the docs and don’t see any C++ bindings from TS exposed that would help, so it looks like its left to the LUA math library or using some value from the ts.client_request. 
> 
> Does that sound right?

You could use http://tieske.github.io/uuid/ 

>  
> 
> Also, if you have advice on specific tips for organizing scripts (1 hook per file or something like that) I would appreciate hearing it
> 
> —Eric
> 
>> On Feb 1, 2017, at 2:41 PM, Shu Kit Chan <ch...@gmail.com> wrote:
>> 
>> Please feel free to ping me or the dev mailing list for questions on
>> the ts- lua plugin
>> 
>> It is very good and easy for making quick fixes to manipulate headers
>> and target origin url.
>> Performance is ok and it is quite stable and I think lots of people
>> are using it in production.
>> 
>> For more complicated tasks, my recommendation is to try to plan ahead
>> in terms of organization and structure of your scripts. I find that
>> making it easy invites more people to try your stuff. But without a
>> good plan for your team, it can get messy very quickly.
>> 
>> Thanks.
>> 
>> Kit
>> 
>> 
>> On Wed, Feb 1, 2017 at 7:44 AM, Eric Friedrich (efriedri)
>> <ef...@cisco.com> wrote:
>>> I’m looking for thoughts on the TS LUA plugin. After Shu Kit’s awesome talk in Sunnyvale, I’ve been considering bringing it into our ATS config. Initially for simple things like setting/getting Cookies, but eventually more complex tasks as well.
>>> 
>>> What are other experiences with TS LUA as far as performance and stability go?
>>> 
>>> Any pitfalls to watch out for?
>>> 
>>> Thanks!
>>> Eric
>>> 
> 


Re: TS LUA Plugin

Posted by "Eric Friedrich (efriedri)" <ef...@cisco.com>.
Thanks Kit-
  One top level question, maybe more directed at use of LUA is how to generate a unique ID or number inside of a plugin. I’ve checked the docs and don’t see any C++ bindings from TS exposed that would help, so it looks like its left to the LUA math library or using some value from the ts.client_request. 

Does that sound right? 

Also, if you have advice on specific tips for organizing scripts (1 hook per file or something like that) I would appreciate hearing it

—Eric

> On Feb 1, 2017, at 2:41 PM, Shu Kit Chan <ch...@gmail.com> wrote:
> 
> Please feel free to ping me or the dev mailing list for questions on
> the ts- lua plugin
> 
> It is very good and easy for making quick fixes to manipulate headers
> and target origin url.
> Performance is ok and it is quite stable and I think lots of people
> are using it in production.
> 
> For more complicated tasks, my recommendation is to try to plan ahead
> in terms of organization and structure of your scripts. I find that
> making it easy invites more people to try your stuff. But without a
> good plan for your team, it can get messy very quickly.
> 
> Thanks.
> 
> Kit
> 
> 
> On Wed, Feb 1, 2017 at 7:44 AM, Eric Friedrich (efriedri)
> <ef...@cisco.com> wrote:
>> I’m looking for thoughts on the TS LUA plugin. After Shu Kit’s awesome talk in Sunnyvale, I’ve been considering bringing it into our ATS config. Initially for simple things like setting/getting Cookies, but eventually more complex tasks as well.
>> 
>> What are other experiences with TS LUA as far as performance and stability go?
>> 
>> Any pitfalls to watch out for?
>> 
>> Thanks!
>> Eric
>> 


Re: TS LUA Plugin

Posted by Shu Kit Chan <ch...@gmail.com>.
Please feel free to ping me or the dev mailing list for questions on
the ts- lua plugin

It is very good and easy for making quick fixes to manipulate headers
and target origin url.
Performance is ok and it is quite stable and I think lots of people
are using it in production.

For more complicated tasks, my recommendation is to try to plan ahead
in terms of organization and structure of your scripts. I find that
making it easy invites more people to try your stuff. But without a
good plan for your team, it can get messy very quickly.

Thanks.

Kit


On Wed, Feb 1, 2017 at 7:44 AM, Eric Friedrich (efriedri)
<ef...@cisco.com> wrote:
> I’m looking for thoughts on the TS LUA plugin. After Shu Kit’s awesome talk in Sunnyvale, I’ve been considering bringing it into our ATS config. Initially for simple things like setting/getting Cookies, but eventually more complex tasks as well.
>
> What are other experiences with TS LUA as far as performance and stability go?
>
> Any pitfalls to watch out for?
>
> Thanks!
> Eric
>