The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-01-13

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:47 Grinnz https://www.reddit.com/r/Overwatch/comments/5nfr25/it_is_a_mystery/dcc1b7w/?context=2 so this is why sri uses so many commas :)
00:48 cpan_mojo Mojo-JWT-0.05 by JBERGER https://metacpan.org/release/JBERGER/Mojo-JWT-0.05
00:58 castaway joined #mojo
01:17 Sebbe joined #mojo
02:25 asarch joined #mojo
02:54 tardisx joined #mojo
03:54 disputin joined #mojo
04:13 disputin joined #mojo
04:54 prajith joined #mojo
05:04 dboehmer_ joined #mojo
06:18 disputin joined #mojo
06:57 Vandal joined #mojo
07:08 dod joined #mojo
07:14 dod joined #mojo
07:16 prajith joined #mojo
07:26 inokenty-w joined #mojo
07:30 preaction joined #mojo
07:42 prajith joined #mojo
07:58 AndrewIsh joined #mojo
08:04 janl joined #mojo
08:06 janl joined #mojo
08:32 trone joined #mojo
08:36 khfeng joined #mojo
08:36 coolo joined #mojo
08:38 sri go does have the best project logos :) http://gobuffalo.io
08:44 Jonis that's amazing
08:47 good_news_everyon joined #mojo
08:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vM2Zi
08:47 good_news_everyon mojo/master 1a37eff Sebastian Riedel: workaround for deprecation warning on Perl 5.10.1 (closes #1036)
08:47 good_news_everyon left #mojo
08:47 sri i'm not sure if this is one of those things we just consider ok on 5.10.1
08:52 sri https://github.com/kraih/mojo/pull/1036#issuecomment-272391851
08:52 sri ¯\_(ツ)_/¯
08:53 Jonis 5.10 is 9 years old now
09:00 prajith joined #mojo
09:06 rshadow joined #mojo
10:44 ashimema joined #mojo
11:29 tchaves joined #mojo
12:29 rshadow joined #mojo
12:37 Peppard joined #mojo
13:21 mib_yiizqi joined #mojo
13:46 aborazmeh joined #mojo
14:03 Dandre joined #mojo
14:10 gizmomathboy joined #mojo
14:52 CW joined #mojo
14:58 asarch joined #mojo
15:07 dikim joined #mojo
15:08 mcsnolte joined #mojo
15:16 Janos joined #mojo
15:21 user_9853 joined #mojo
15:21 user_9853 What's the recommended way to balance the requests to a Mojo restful api endpoint?
15:22 user_9853 Imagine you have 100-1000 of requests per seconds, not everything can be made non-blocking
15:22 pink_mist hypnotoad with the number of workers you need
15:24 user_9853 there are parts of the code that are not non-blocking, such as a database connection (which is usually fast)
15:24 user_9853 with 1000 requests it would hang?
15:24 user_9853 or at least delay a bit
15:25 user_9853 so can i run multiple instances behind nginx and use a loadbalancer?
15:25 pink_mist hypnotoad with multiple workers *IS* running multiple instances with a loadbalancer
15:25 zivester joined #mojo
15:25 user_9853 really?
15:26 pink_mist it's not the best of loadbalancers, but it's something
15:26 pink_mist but yes
15:29 user_9853 Just that i got it right:
15:29 kwa Is this a hypothetical question, or are you actually having problems?
15:34 user_9853 I don't have any problems
15:34 user_9853 but the endpoint can be called heavily. it cleans certain datasets from invalid data.
15:35 user_9853 i will not have a batch api as soon
15:36 user_9853 and under { } has a blocking mysql database connection to check whether the api key/secret is valid.
15:36 user_9853 the cleaning of the datasets is non-blocking
15:37 kwa Right. Well, you approach seems sane. As pink_mist said, you can run multiple workers with hypnotoad, so if your app blocks, you just need to increase the amount of workers http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Hypnotoad
15:38 kwa You can scale by adding a pool of hypnotoads behind nginx's reverse proxy once you hit your machine's limits.
15:41 user_9853 Sounds good
15:41 user_9853 so i'll start with 32 workers (2x 8 cores cpu)
15:42 kwa That's starting pretty high. You expecting a LOT of requests?
15:42 kwa From the get go.
15:42 user_9853 not really, but would it draw any performance to have more workers than needed?
15:42 kwa It would probably end up opening 32 connections to your database and have them hang around.
15:43 kwa Other than that, just seems a bit overkill. :)
15:47 user_9853 true
15:48 user_9853 but i'll have to add some logging then
15:49 user_9853 to monitor the response time or i would not know when to increase the workers.
16:04 lluad joined #mojo
16:08 kwa Seems like information you'd want to know regardless. Otherwise you're just throwing a load of resources at something, and assuming the amount of resources you'd got will handle all the requests.
16:11 sri just my luck, reviewing a big pull request on github... and github goes down
16:12 sri oh yea, friday 13
16:12 sri of course it's angry unicorn day
16:16 genio I do like that angry unicorn graphic though :)
16:46 user_9853 Does one of you know the reason why my JSON is messed up when i wrap the code from sub { } inside a helper and then call it through $self->..?
16:46 user_9853 Works: beautify_json(Error => [ordered_hash_ref('Code' => '5', 'Text' => 'test123',  'Message' => undef)]);
16:46 user_9853 Doesn't work: $self->beautify_json(Error => [ordered_hash_ref('Code' => '5', 'Text' => 'test123',  'Message' => undef)]);
16:46 user_9853 Instead of JSON following is printed: "Mojolicious::Controller=HASH(0x53f2ba0)" : "Error",
16:47 user_9853 I just wrapped the code inside helper beauitfy_json => sub { } from the normal function. Then it's messed up.
16:49 perlpilot user_9853: and you handled $self in that code?
16:49 perlpilot user_9853: show the actual code.
16:49 user_9853 yes $self = shift;
16:49 vicash on pastebin
16:52 user_9853 http://pastebin.com/exBB4pFT
16:52 user_9853 the code runs fine, but output messed up once wrapped inside helper
16:53 vicash user_9853: the code has a mistake. you need to do this "beautify_helper => sub { my $c = shift; my $json = ... }
16:54 vicash user_9853: i meant "beautify_json" and you need to shift out the first argument since you're calling it as $self->beautify_json where $self will be passed in as the first argument, followed by the rest of the JSON stuff
16:54 disputin joined #mojo
16:55 vicash user_9853: you also need to do that with the other helper function too..
16:58 user_9853 oh yeah i forgot about it lol
16:58 user_9853 shifting first arg then it works
16:58 vicash user_9853: in the future you can use Mojo::Util::dumper() to dump the @_ in such cases to see where you're missing stuff and why your arguments are not as expected. it will save you trouble.
17:08 PopeF0 joined #mojo
17:11 user_9853 Thanks for all.
17:21 rshadow joined #mojo
17:35 dod joined #mojo
17:45 jamesaxl joined #mojo
17:45 jamesaxl hi
17:46 jamesaxl I see that mojo can not accetp $c->render(json => %data);
17:46 Grinnz json encoding takes a reference, not a list
17:46 Grinnz json => \%data
17:46 jamesaxl Grinnz, thanks fro this info
17:47 jamesaxl s/for/fro
17:52 disputin joined #mojo
18:12 sh14 joined #mojo
18:45 good_news_everyon joined #mojo
18:45 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMa0v
18:45 good_news_everyon mojo/ioloop_tls a5ce008 Sebastian Riedel: Mojo::IOLoop::TLS can now negotiate in both directions
18:45 good_news_everyon left #mojo
18:46 sri looks like it's currently 14 lines more code
18:58 good_news_everyon joined #mojo
18:58 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMauv
18:58 good_news_everyon mojo/ioloop_tls fcb9107 Sebastian Riedel: use a little less code
18:58 good_news_everyon left #mojo
18:58 sri down to 3 lines
19:05 marty joined #mojo
19:13 dboehmer joined #mojo
19:20 good_news_everyon joined #mojo
19:20 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMa2U
19:20 good_news_everyon mojo/ioloop_tls 7b789aa Sebastian Riedel: use even less code
19:20 good_news_everyon left #mojo
19:20 sri and 0 lines :)
19:20 sri but there is still a risk of leaks
19:21 janl left #mojo
19:36 rshadow joined #mojo
19:38 good_news_everyon joined #mojo
19:38 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMaVh
19:38 good_news_everyon mojo/ioloop_tls 6a9a9fc Sebastian Riedel: add documentation for Mojo::IOLoop::TLS
19:38 good_news_everyon left #mojo
19:38 sri ok, thoughts on https://github.com/kraih/mojo/compare/ioloop_tls?
19:39 sri synopsis https://github.com/kraih/mojo/compare/ioloop_tls#diff-4ae7b7f1fbef554da39b1d125642c2c7R89
19:47 rshadow joined #mojo
19:53 good_news_everyon joined #mojo
19:53 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMao4
19:53 good_news_everyon mojo/ioloop_tls ecb8c20 Sebastian Riedel: the handle is required anyway
19:53 good_news_everyon left #mojo
19:55 rshadow joined #mojo
20:00 jberger sri: on quick glance I like it
20:00 jberger but that's only a quick glance
20:01 jberger I'll give it a read after work
20:05 Janos joined #mojo
21:30 rshadow joined #mojo
21:38 rshadow joined #mojo
21:50 karjala Thanks so much, mr Sri
21:51 karjala I tried to help in the afternoon, but couldn't quite do it.
21:51 sri don't thank me too quickly, it doesn't work right yet
21:51 sri there's leaks
22:02 good_news_everyon joined #mojo
22:02 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMabO
22:02 good_news_everyon mojo/ioloop_tls 94d7e87 Sebastian Riedel: fix a few leaks
22:02 good_news_everyon left #mojo
22:04 sri now the cost is back up to 9 lines of code
22:07 good_news_everyon joined #mojo
22:07 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMaNv
22:07 good_news_everyon mojo/ioloop_tls 65fd4c6 Sebastian Riedel: fix typo in example
22:07 good_news_everyon left #mojo
22:24 disputin joined #mojo
22:25 go|dfish joined #mojo
23:07 good_news_everyon joined #mojo
23:07 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMVJg
23:07 good_news_everyon mojo/ioloop_tls ba0f17e Sebastian Riedel: just store the arguments
23:07 good_news_everyon left #mojo
23:08 sri jberger, marcus, batman, tempire, crab: i'd like a vote on https://github.com/kraih/mojo/compare/ioloop_tls
23:09 sri it should be leak free again, but who knows... big question now is if it is worth adding 9 lines of code
23:15 disputin joined #mojo
23:22 sri advantages are unified TLS code, possibly better tests in the future and ability to reuse it for protcol modules that require TLS upgrade on an existing connection, like smtp
23:29 good_news_everyon joined #mojo
23:29 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMVkc
23:29 good_news_everyon mojo/ioloop_tls ac15003 Sebastian Riedel: undef defaults are fine
23:29 good_news_everyon left #mojo
23:30 mishanti1 sri: Do you prefer any particular tool for leak-detection?
23:31 sri have not found a good one yet
23:32 sri doing it mostly manually with the os x activity monitor and Devel::Cycle
23:32 sri would welcome suggestions for how to do it better though :)
23:32 mishanti1 Me neither. I mean, some of the Devel::* modules are _ok_, but I often fall back to just using Valgrind (which is by no means perfect either).

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary