owt-server icon indicating copy to clipboard operation
owt-server copied to clipboard

how to reduce the cpu usage when use service recording

Open victor-xi opened this issue 4 years ago • 12 comments
trafficstars

When I use recording service of owt-server, by send "https://server ip: port/rooms/" + that.myRoom + "/recordings" The cpu usage climbs to 95% for 1 room with 3 participants , compares to cpu usage of 60% for 10 rooms each with 2 participants when not use server recording. So how to reduce the cpu usage when use service recording? Thanks for help.

victor-xi avatar Nov 17 '21 08:11 victor-xi

Could you provide more information of the CPU load when recording is on? Like which process consumes most CPU.

starwarfan avatar Jan 18 '22 07:01 starwarfan

Could you provide more information of the CPU load when recording is on? Like which process consumes most CPU.

H264 Codec related processes cosume 80% of the CPUs

victor-xi avatar Jan 18 '22 07:01 victor-xi

Video transcoding process or recording process? have you used commands like top -c to check the detail stats?

starwarfan avatar Jan 18 '22 08:01 starwarfan

We use tool perf top to check, find that almost all by many videoTranscoder-sw.node

Samples: 596K of event 'cpu-clock', Event count (approx.): 9613761102
Overhead Shared Object Symbol
4.33% videoTranscoder-sw.node [.] vp8_pack_tokens 3.70% videoTranscoder-sw.node [.] vp8_short_fdct8x4_sse2 3.45% videoTranscoder-sw.node [.] vp8_pick_inter_mode 3.18% videoTranscoder-sw.node [.] vp8_tokenize_mb 3.12% videoTranscoder-sw.node [.] vp8_fast_quantize_b_ssse3 2.54% videoTranscoder-sw.node [.] CopyRow_ERMS 2.44% videoTranscoder-sw.node [.] vpx_get16x16var_avx2 2.42% beam.smp [.] process_main 2.30% videoTranscoder-sw.node [.] vpx_post_proc_down_and_across_mb_row_sse2 2.12% videoTranscoder-sw.node [.] vp8_mbloop_filter_vertical_edge_sse2 2.05% [kernel] [k] _raw_spin_unlock_irqrestore 1.98% videoTranscoder-sw.node [.] vpx_sub_pixel_variance16xh_ssse3 1.97% [kernel] [k] finish_task_switch 1.75% videoTranscoder-sw.node [.] vpx_subtract_block_sse2 1.50% videoTranscoder-sw.node [.] vp8_build_inter16x16_predictors_mb 1.41% videoTranscoder-sw.node [.] vp8_copy_mem16x16_sse2 1.36% videoTranscoder-sw.node [.] vp8dx_decode_bool 1.30% videoTranscoder-sw.node [.] vp8cx_encode_inter_macroblock 1.29% videoTranscoder-sw.node [.] vp8_mbloop_filter_vertical_edge_uv_sse2 1.08% videoTranscoder-sw.node [.] vpx_sad16x16_sse2 1.06% videoTranscoder-sw.node [.] vp8_loop_filter_bv_y_sse2 1.05% videoTranscoder-sw.node [.] vp8cx_mb_init_quantizer 0.89% videoTranscoder-sw.node [.] vp8_mbloop_filter_horizontal_edge_sse2 0.82% videoTranscoder-sw.node [.] vp8_encode_bool 0.75% libc-2.27.so [.] 0x000000000018ee6d 0.68% videoTranscoder-sw.node [.] vp8_copy_mem8x8_mmx

victor-xi avatar Jan 18 '22 09:01 victor-xi

Seems that transcoding costs a lot of CPU. How many recordings did you have for 1 room?

starwarfan avatar Jan 19 '22 01:01 starwarfan

Seems that transcoding costs a lot of CPU. How many recordings did you have for 1 room?

Only 1 participant in the room, so 1 recording. my question is, if the source video track use the same codec with recording, why does it need transcoding?

victor-xi avatar Jan 19 '22 01:01 victor-xi

It should not trigger transcoding if all parameters match source (codec, bitrate, resolution etc.). Have you specified video parameters when recording? If not, it could be an issue to fix.

starwarfan avatar Jan 19 '22 01:01 starwarfan

We enable recording from client using REST API like below, no specified parameters on server: data = {"audioId":remoteStreamId,"videoId":remoteStreamId,"roomnum":that.myRoomNum,"mp3":"mp3","userId":that.userName,"container":"mkv"}; ... url:"https://ip:3004/rooms/"+that.myRoom+"/recordings",

victor-xi avatar Jan 19 '22 02:01 victor-xi

Which branch were you using?

starwarfan avatar Jan 19 '22 02:01 starwarfan

v4.3.1

victor-xi avatar Jan 19 '22 02:01 victor-xi

I tried 4.3.1, and didn't find transcoding when recorded stream with same codec. Maybe your transcoding is triggered by participant subscription? For example, user A published vp8 stream but user B subscribed different format (codec, resolution etc.).

starwarfan avatar Jan 19 '22 02:01 starwarfan

Only 1 participant in the room when the lateset test, so it should not be the reason that 2 users with different format. We'll check it.

victor-xi avatar Jan 19 '22 02:01 victor-xi