简体   繁体   English

如何为应用程序中的每个用户创建实例

[英]How to create an instance for every user in an app

I am not sure if the wording in my question is correct but I have had this on my mind for some time and would just like to be pointed into the right direction. 我不确定问题中的措词是否正确,但是我已经想了很长时间了,只是想指出正确的方向。

When we build apps in my case a webapp, all the users run and use the same source code right, how do we handle situations where the app needs to produce some files and send them back to the user? 在我们以Web应用程序为例构建应用程序时,所有用户都可以正确运行并使用相同的源代码,我们如何处理应用程序需要生成一些文件并将其发送回用户的情况? Do we queue all the queries and let the app handle them one by one or is there a way to have multiple instances of the app running to handle these requests? 我们是否将所有查询排队,让应用程序一个接一个地处理它们,或者是否有办法让应用程序的多个实例运行来处理这些请求?

For example an app that uses Vuejs and Nuxtjs to generate static HTML websites, the nuxt framework generates the website and puts all the files in a /dist folder, which are than moved to a Git or server. 例如,一个使用Vuejs和Nuxtjs生成静态HTML网站的应用程序,nuxt框架生成该网站并将所有文件放在/ dist文件夹中,然后将其移到Git或服务器中。

Is this the correct way to do it? 这是正确的方法吗? Have the app create these files concurrently and move them to their destination? 该应用程序是否同时创建了这些文件并将其移至目的地? What if we have 1000 users at a time, won't this drastically slow down usability of our app? 如果我们一次只有1000个用户怎么办,这不会大大降低应用程序的可用性吗?

I am a junior developer and I have never really understood how my code works on the inside if this makes sense, if you could recommend a book on systems architecture or design or something that would help me that would be amazing. 我是一名初级开发人员,如果可以的话,如果您可以推荐一本有关系统架构或设计的书,或者对我有帮助的书,我从来不会真正理解我的代码在内部如何工作。

Serving up pre-generated static files with client side javascript, is the minimal drain on a server. 使用客户端javascript提供预生成的静态文件,是服务器上的最小消耗。 Because after the files are delivered all the work is done in the client side (except for future queries). 因为文件交付后,所有工作都在客户端完成(以后的查询除外)。

They are not created on load, like for example with PHP but only served as is. 它们不是在加载时创建的,例如使用PHP创建,而是仅按原样提供。

So the code they are running is really in the client side. 因此,他们正在运行的代码实际上是在客户端。

Additionally if you CDN deployment services like Netlify, then delivering static files quickly is a breeze. 此外,如果您使用CDN部署服务(例如Netlify),则快速交付静态文件非常容易。

Hope that answers your question. 希望这能回答你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM