prevent extremely slow performance of codeigniter application [closed] - css

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Currently i am developing an student information system and i am using premium bootstrap template for my application development. But the problem is now my web app being extremely slow; at first i thought that all of the different css files and js are the main reason for the issue; so i have magnify both css and js than put it into the one single file.
which makes my application 10 second faster than previous one. But the problem is now my apps gets 30 sec to load a single page. Also i have put all of the models in the single file which is 69KB in size. and i have done same for my controller which is 178KB in size.
I have also tried to implement cache on my controller which make my app just load in 10 sec but the problem is when i do CRUD operation then the changed result is not showing insistently. So my question is how can i make the application load time much faster.

There can be many reasons how your application is slow.
Use Autoload only whenever required.
Keep the config files in cofig directory.
Filter all input before adding them to DB.
Use less of core PHP code if there is an CI alternative.
Use helper or library for frequently used functions.
Also,
- Enable GZIP compression if you are on a online server.
- make fewer HTTP requests.
- Config files there are alot of you can disable to speed up.
Although this is just my view. There are many ways to speed up and many reasons slowing your application. It is all onhe your study on how you have coded your application.
hope this helps a little. :)

Related

Gatsby or NextJS for ecommence complex site [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have below applications:
a magento2 e-commence site with Restful API in docker
some nodejs micro service Restful API in docker
i have question, if i wanna to develop a ecommence + user portal frontend site, which framework i should pick? NEXTJS or GATSBY?
given that:
i have over 30000 user
I need to serve more than 10 locales, and may keep increasing
I need to serve more than 10 countries , and may keep increasing , and each of those may many different localisation setting
i have over 10 store represent 10 countries , each of them has more than 20 products, and may increasing
I do not agree with Zain Ui Hassan's answer.
With Gatsby, it doesn't matter the amount of asynchronous data your site will have, the number of pages, or the dynamic data. In the end, it is a React site with all the content already fetched and served, so it's blazing fast. Moreover, you have a bunch of official plugins that manage all your needs.
You will be able to handle a S3 AWS deploy.
Multilanguage support with redirections included and dynamic routes
CMS fetched data with a bunch of multiple CMS support (Contentful CMS, DatoCMS, Strapi, Netlify CMS, markdown files, JSON files, custom database, etc).
Lambda support.
You don't need a Node server to deploy or view a Gatsby website since it renders a static HTML, so you don't need any extra configurations, just a server, all pages are created in the build time. Next.js needs server-side customization and rendering.
In addition, it's SEO-friendly, you can easily customize your components to render (even when the page is already created) with the proper country-oriented data.
In the end, it's completely up to you, but in my opinion, you will need fewer configurations and you will have less trouble using Gatsby, due to the few and easy configurations.
In terms of community, both have great support so it's a tie.
Personally, I think that the only area where Next.js would be the better option at the moment is scalability since Gatsby, especially in large-scale projects, will increase the deploy time (up to 10 minutes, which is not ideal) but I know they are working on improving this by implementing incremental builds. I reduced my deploy time from 8 minutes to 2.
but i do want to know more, if a page path that depends on user, e.g
/myinbox/letter-from-tom-to-stanley, each user may have different msg
on their inbox, and each inbox may have different path depend on user
This will depend on your code logic rather than the framework used. Of course, you are able to achieve this both with Gatsby and Next. I'm doing similar stuff with Gatsby and I have no issues. Of course, you will need a back end logic sometimes (database stuff), but it's completely doable.
Answering your question. It's a personal choice and you can fit your specifications with both (like the other question shows). I would choose Gatsby because it's more oriented towards SEO (conversion), easy to maintain if it's well structured (data-entity in CMS, etc), the plugin support, and the fewer (minimum) server configurations since you are uploading a /public compiled folder.
Useful articles:
https://dev.to/jameesy/gatsby-vs-next-js-what-why-and-when-4al5#:~:text=JS%20is%20mainly%20a%20tool%20for%20server%2Dside%20rendered%20pages.&text=Gatsby%20can%20function%20without%20any,HTML%20page%20from%20the%20server
https://www.gatsbyjs.org/features/jamstack/gatsby-vs-nextjs
https://medium.com/frontend-digest/which-to-choose-in-2020-nextjs-vs-gatsby-1aa7ca279d8a
Gatsby is used for static websites where you don't have lots of dynamic data. If you are building complex level website go with NextJs.
Next.js has the best-in-class "Developer Experience" and many built-in features; a sample of them are:
An intuitive page-based routing system (with support for dynamic routes)
Pre-rendering, both static generation (SSG) and server-side rendering (SSR) are supported on a per-page basis
Automatic code splitting for faster page loads
Client-side routing with optimized prefetching
Built-in CSS and Sass support, and support for any CSS-in-JS library
Development environment which supports Hot Module Replacement
API routes to build API endpoints with Serverless Functions
Fully extendable
https://nextjs.org/

What are the cost/benefits of bundling a single file in ASP.NET? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am creating a website using asp.net mvc5 and I need to add one particular css and js file to a single page. My question is, what would be the benefit of creating a new bundle for a single css or js file? Or is bundling a single file bad practice, and I shouldn't do it?
The code below is what I mean by not bundling vs bundling a single file:
Traditional Method:
<link href="/content/css/foo.css" rel="stylesheet"/>
<script src="~/content/js/bar.min.js"></script>
Bundle Method:
bundles.Add(new ScriptBundle("~/bundles/bar").Include(
"~/content/js/bar.min.js"));
bundles.Add(new StyleBundle("~/content/foobundle").Include(
"~/content/css/foo.css"));
This question is in reference to bundling single files only. Like in my case, I am using a date-picker plugin that is only being used on one page in my ASP.NET MVC application, so it does not make sense to add the css and js files to my entire website bundle.
First, bundling is a once-and-done thing, so I wouldn't focus much on the performance cost of bundling. In other words, the first time the bundle is requested, it must be created, but each subsequent request just statically serves up the previously created file (assuming you don't change the bundle).
Is there value in bundling a single file? Well, that depends on that single file. How large is it? Is it already minimized? If it's a large, unminimized file then yes, there's very much value in bundling it as the bundle version will be a smaller filesize. It's more obvious of course with multiple files, as there you're not only reducing file size but also requests. However, I would still recommend that you always just use bundles. Like I said above, the cost of bundling is occurred only on the first request, which if you're truly concerned about it, could always be requested by you after you publish the site. Then, each further request is statically served until you change the bundle.
Its a valuable feature and much more valuable on a production environment. That being said, on the projects I'm on - we use the feature regardless of the number of files.
This SO answer is really good:
What is the benefit of ASP.NET bundling and minification in runtime?

FTP or HTTP for internal collaboration? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm making an app with a friend. I have a server which supports PHP and MySQL which my app is based on.
So we need to collaborate when making the app.
We are using Dreamweaver and NetBeans and apps on our phones...
The question is:
Is it secure to put the app we are developing on the web while its under development, and what should we use to protect it from the outside world?
Will Password Protected FTP be a good solution? or HTTP with a password protected folder?
I have seen there is a problem in HTTP protected folders. The login accepts a some other passwords too. Like if the password is helloworld123 and you login with helloworld it would accept and login?
SO I think HTTP will not be a good solution. And if it is then how should i make it more secure?
So what should I use? FTP or HTTP? thanks...
If you are developing an application, you should really be developing it locally.
You will rapidly tire of testing a change by uploading it to a remote server.
Additionally, what happens if your friend makes a change, how do you know that he has made that change? You will very quickly get collisions in code which totally ruin your collaboration.
So first of all, you should both install a LAMP/MAMP/WAMP stack locally. You should be testing everything locally, and you don't need to publish it to a server to test.
Then, you should be using some kind of version control in order to add any changes you make to a remote repository. This means that then you and your friend can work in isolation from each other, and then commit your own changes to a repository, and then you can merge the branches as you go.
When your application is then finished, you can then start to think about putting it into a production ready state by adding it to a server.
Sign up for an account at GitHub.com read as much as you can about how version control works, because if you intend to work together on anything you need to wrap your head around it.
If possible I'd always reccomend using localhost and syncing with Dropbox or any similar app. Otherwise you can try .htaccess to prevent anyone other than you and your friend from accessing your page.

Stress Testing ASP.Net application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
what are different ways that we can do some optimum level of stress testing for asp.net application before moving it to the production environment ?
Here is the free tool for the stress testing in asp.net application.
https://learn.microsoft.com/en-us/archive/blogs/alikl/stress-test-asp-net-web-application-with-free-wcat-tool
Another is called asp.net performance engineering which will tell how we can stress application.
https://learn.microsoft.com/en-us/archive/blogs/alikl/asp-net-performance-engineering-stress-test-your-architecture-design-and-code
Also go through the following post:
Best way to stress test a website
From my experience before moving to the production environment please take of following things.
set debug=false into the web.config
set trace enabled=false into the web.config
Always use precompiled version of your code.
Compile your project into the release mode.
Publish your code if you are using asp.net 2.0 or higher version
User caching api as much as possible.
Decrease your html kb.
remove blank spaces from the asp.net html code.
Use stylesheet as external .css file
USE IIS Compression if poosible.
Put your javascript file in .js files
Use Server.Transfer instead of Response.redirect
Use Inproc Session State if possible.
Use Viewstate efficiently- Use controlstate instead of viewstate which is newer feature in asp.net 2.0
Avoid giving big name to controls it will increase your html kb.
Use Div instead of tables it will decrease your size.
Do IIS Performance tuning as per your requirement
Here is the good link that teaches us good way of deployment in production environment.
http://www.vbdotnetheaven.com/UploadFile/dsdaf/111222006014732AM/1.aspx
Apache JMeter (http://jmeter.apache.org/) is an excellent tool for stress-testing web applications. It can be used with any web server, not just Apache.
Visual Studio 2010 provides some fantastic Test Automation tools and also for Load Testing the web applications.

License a .Net Web Site [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was wondering what is the preferred method of licensing a web site?
I distribute precomplied versions of my web sites with editable APSX files, the code behind is complied into separate DLL's for each page.
I have thought of implementing some sort of text injection into each page, similar to what Telerik controls do, when using a trial version. This demo text would disappear if using a licensed version.
One way I would think is to have the web site contact a web service to determine the license status but this would be an issue if the web service is down for any reason.
Thanks
It's absolutely unacceptable to have your controls rely on an external web service to check the license. The only thing you're going to get out of that is pissed off customers and maintenance issues for yourself.
I strongly encourage you to go with the honor system, or a very simple licensing key file (that never expires). You're selling a web site, not video games. Unless you know for a fact that you are losing significant money because of piracy of your product, do not waste your time. Remember the first rule of optimization!
you could build some sort of license controlmechanism into your website. therefore you could use the URL of the site (typically you sell your asp.net app for one or two urls to somebody), and e.g. you could also build some hardware-key-references into your license mechanism, so that a copy of your software is not possible to run on a different machine.
but keep in mind, all restrictions you build in will result in more work for your paying clients, and there is always somebody who want to try to use your software without paying it!

Resources