WEBVTT

00:00.350 --> 00:01.070
Hey, everyone.

00:01.070 --> 00:01.910
And welcome back.

00:01.910 --> 00:06.980
In today's video, we will be discussing about the modular architecture of Enginex.

00:07.010 --> 00:15.050
Now, modular architecture basically refers to the design of any system composed of separate components

00:15.050 --> 00:18.050
that can be connected to each other.

00:18.050 --> 00:21.950
So this can be better explained with this diagram over here.

00:21.950 --> 00:28.550
So generally nowadays, whenever a car manufacturing happens, there are multiple components which are

00:28.550 --> 00:33.320
manufactured independently and only during the final process.

00:33.320 --> 00:37.490
All of them are connected with each other and tested.

00:37.640 --> 00:42.260
Now, this is a great way of design and it also helps.

00:42.260 --> 00:48.500
So let's say if there is a defect in one component, you can easily disassemble everything, remove

00:48.500 --> 00:51.650
that component and replace it with the brand new one.

00:51.650 --> 00:55.340
So this is the right approach of doing things.

00:55.550 --> 01:02.940
I still remember one of the persons that I know, so he had a car and there was some issue with one

01:02.940 --> 01:04.950
of the components in that car.

01:04.950 --> 01:11.760
So he went to a garage and the garage said that in order to remove that one component, he will have

01:11.760 --> 01:13.830
to replace four other components.

01:13.830 --> 01:16.140
So everything was ticked together.

01:16.140 --> 01:21.330
It was not modular and he had to pay a good amount of price for that.

01:21.330 --> 01:28.020
So this is the reason why nowadays even car manufacturers, their architectures are quite modular.

01:28.020 --> 01:34.440
So in the longer term, if one of the component fails, you can easily replace that component without

01:34.470 --> 01:36.300
touching any other one.

01:36.300 --> 01:43.620
So this kind of a design not only is applicable to the manufacturing industry, but also to the software

01:43.620 --> 01:44.340
industry.

01:44.340 --> 01:51.030
And if you talk about various new applications, the operating systems, everything is built out of

01:51.030 --> 01:52.410
modular architecture.

01:52.410 --> 01:58.830
Now, speaking about modular architecture, definitely Enginex is also built out of modular architecture.

01:58.830 --> 02:04.650
So in fact Nginx is in fact a collection of multiple modules.

02:04.650 --> 02:11.760
Now, since it is a modular architecture, we can extend the functionality of Enginex by readily adding

02:11.760 --> 02:13.230
various third party modules.

02:13.230 --> 02:17.520
So this can be better understood with the diagram here where you have a enginex here.

02:17.520 --> 02:19.650
So this is a enginex binary.

02:19.650 --> 02:26.280
It consists of certain core modules which are required for the web server itself to function.

02:26.280 --> 02:31.980
Now apart from this core modules, you can add various other modules as well.

02:31.980 --> 02:37.080
So let's say you have a Geoip module, so you can go ahead and add a Geoip module.

02:37.080 --> 02:42.240
You have a web application firewall module, you add it, you have a video streaming module, you add

02:42.240 --> 02:49.260
it, and together you can have a single nginx binary, which not only contains core module, but it

02:49.260 --> 02:52.050
also contains various third party modules.

02:52.050 --> 02:58.550
So in case, let's say as a user, I want certain additional functionality in Nginx, what I'll do,

02:58.560 --> 03:05.910
I'll create my own new module and I'll add that module to Nginx and boom, I have a Nginx with my own

03:05.910 --> 03:13.980
custom functionality and this is a great approach and it provides Nginx a great capability.

03:13.980 --> 03:15.330
So let's do one thing.

03:15.330 --> 03:18.510
Let me quickly show you on how exactly it might look like.

03:18.510 --> 03:25.410
So if I do a nginx hyphen v you will see that there are a lot of subset of options.

03:25.410 --> 03:30.720
One of them are basically the modules that this nginx binary has been compiled with.

03:30.750 --> 03:33.540
So if you see over here there are a lot of modules.

03:33.540 --> 03:36.450
One is the Http gzip module.

03:36.450 --> 03:43.740
Then you have the Http random index module, you have the secure link module, you also have the stream

03:43.740 --> 03:45.360
SSL module and etcetera.

03:45.360 --> 03:48.810
So this specific nginx binary that we are running.

03:48.810 --> 03:52.440
So this nginx binary contains all of these modules.

03:52.440 --> 04:00.540
So it contains multiple modules and in case if you have your own module you can go ahead and add your

04:00.540 --> 04:01.830
module as well.

04:01.830 --> 04:03.210
So this is one way.

04:03.210 --> 04:10.380
Now in fact this is just an example of Nginx Now when you talk about Apache, so let's go to the Httpd.

04:10.410 --> 04:12.030
So I have Apache installed.

04:12.060 --> 04:18.840
Now if you go into the modules directory here and if you do ls hyphen L, you will see that there are

04:18.840 --> 04:23.820
a lot of modules here, even Apache works based on the modular architecture.

04:23.820 --> 04:27.900
So all of these things that you see, these are the modules of Apache.

04:28.260 --> 04:32.820
All right, So it's not that just Nginx is doing it, even Apache is doing that.

04:32.820 --> 04:38.820
And even if you do an LS mod, you see all of these are the modules of the Linux subsystem.

04:38.820 --> 04:45.150
So if you go a bit down, you see this is the module name and all of these are module which Linux kernel

04:45.150 --> 04:46.230
is been using.

04:46.230 --> 04:51.030
So if you want to add a new module in Linux, you can easily do that.

04:51.030 --> 04:55.560
If you want to remove a module in Linux, you can easily do that.

04:55.560 --> 04:59.940
So this is one of the approaches of designing.

05:00.100 --> 05:02.200
The software applications.

05:02.380 --> 05:07.480
Now, whenever you plan to add modules, there are two important concepts that you need to remember.

05:07.510 --> 05:09.170
First is the static modules.

05:09.190 --> 05:11.220
Second is the dynamic modules.

05:11.230 --> 05:13.590
So let's go ahead and understand both of them.

05:13.600 --> 05:20.650
So static modules are compiled into your Nginx server binary at compile time.

05:20.650 --> 05:21.870
So what happens here?

05:21.880 --> 05:24.360
Let's say you have a nginx binary over here.

05:24.370 --> 05:27.160
So this binary has two modules.

05:27.160 --> 05:30.730
So you have the GZip module and you have the MP4 module.

05:30.730 --> 05:33.970
So this is a pre-packaged binary.

05:33.970 --> 05:40.000
So advantage of this is you have a single package, it is portable and it will work out of the box.

05:40.000 --> 05:47.950
So if I just take this binary and put it in a different server and I install, then I will have nginx

05:47.950 --> 05:49.660
running with both of these modules.

05:49.660 --> 05:52.480
All right, so this modules are part of the package.

05:52.480 --> 05:58.960
Now the problem with static modules are that it can create issue in a longer time.

05:58.960 --> 06:00.770
If you have a lot of static modules.

06:00.770 --> 06:04.190
So let's say that I have two static modules within my Nginx binary.

06:04.190 --> 06:08.660
Now there is a issue with the GZip module due to which a lot of things are not working.

06:08.660 --> 06:15.770
So if I want to remove this module altogether to just troubleshoot whether my nginx works well without

06:15.770 --> 06:20.510
this module, I cannot do that because this module is part of the binary.

06:20.540 --> 06:26.660
All right, so then it becomes a little difficult to troubleshoot because everything is part of the

06:26.690 --> 06:27.670
binary here.

06:27.860 --> 06:30.740
Now you also have dynamic modules.

06:30.740 --> 06:37.490
So dynamic modules are something that we can create or we can even directly download the module files.

06:37.490 --> 06:44.060
And now what we do is we reference the path of the dynamic module with the load module directive within

06:44.060 --> 06:45.650
the Nginx configuration.

06:45.650 --> 06:51.200
So now let's say that this is the Nginx configuration here and we have two modules here.

06:51.200 --> 06:53.540
So these two modules are dynamic.

06:53.540 --> 06:57.650
One, they are not built inside the nginx binary.

06:57.860 --> 07:04.400
All right, so now what we do is if we let's say if I want to use this GZip module, so within my Nginx

07:04.400 --> 07:08.600
configuration file, I'll say load underscore module, I'll say GZip.

07:08.630 --> 07:09.980
This is just an example.

07:09.980 --> 07:14.000
All right, So now you will have the GZip module at runtime.

07:14.000 --> 07:15.920
So I want to use MP4 module.

07:15.920 --> 07:19.610
I'll say load underscore module mp4 and we'll have the mp4 module.

07:19.610 --> 07:24.950
So during the longer term, let's say that you are seeing a lot of issues and you suspect that it is

07:24.950 --> 07:26.450
because of the GZip module.

07:26.480 --> 07:30.770
What you do, you just remove this line and reload your nginx and that's about it.

07:30.770 --> 07:33.170
Your module is no longer being used.

07:33.170 --> 07:39.800
So dynamic modules provides a lot of advantages in the Nginx architecture.

07:40.040 --> 07:43.370
Now before we conclude, let me quickly show you one thing.

07:43.940 --> 07:49.820
So within the Nginx official website you have the page of Nginx third party modules.

07:49.820 --> 07:56.660
So currently you see there are a lot of modules of third party which are available and many of them

07:56.660 --> 07:59.780
are very important which you can use.

07:59.780 --> 08:05.000
So Nginx by itself does not come with a huge amount of functionality.

08:05.000 --> 08:11.090
The major important part of the functionality typically comes with the help of a third party modules.

08:11.090 --> 08:18.620
So you can directly, let's say that you want to make use of a Http digest authentication or a Pam authentication.

08:18.620 --> 08:21.110
So you just get the Pam module.

08:21.200 --> 08:27.560
Either you can do a static compile, you can do a dynamic compile depending upon the use case, and

08:27.560 --> 08:32.480
then you can have your Nginx which supports the Pam based authentication.

08:32.480 --> 08:37.040
So similarly you have a lot of modules which you can use out of the box.

08:37.040 --> 08:41.480
So that's the high level overview about the modular architecture of Nginx.

08:41.600 --> 08:49.430
Again, in the upcoming videos, we'll look into how exactly we can do both static compilation of modules

08:49.430 --> 08:53.300
as well as reference to dynamic modules within our Nginx.

08:53.300 --> 08:57.830
So the upcoming videos would prove to be quite interesting.

08:57.830 --> 09:00.020
So that's about it for today's video.

09:00.020 --> 09:03.860
I hope this video has been informative for you and look forward to see you in the next video.
