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 9 years ago.
Improve this question
I've been writing some console applications in c++ for working with audio for a little while now and I'm interested in running them on a website. Most of my programs are quite resource-hungry, however, some with execution times of up to 5-10 min, reading and writing several gigabytes to and from disk, and requiring several gigabytes of memory. I've done a few simple php-mysql pages before, but nothing like this, so before i get my hopes up and dive into learning how to get an application running on a website, i figure i should ask a few questions:
Is it even feasible to run a program like this on the web? How would performance on a server compare to my PC?
Do web hosts typically allow a single user to use this kind of memory?
I realize c++ isn't usually the first choice for web programming, but since performance will be critical would it be better than Java?
I know nothing about this, so i'm just trying to get my expectations straight.
This is my opinion:
1 - The user of your web application is probably not going to wait 5-10 min for a response. You can focus on doing the hard-work on another process and your web app later shows the results to your user in some way.
2 - Yes, they allow, but that costs money. You can see Amazon EC2 and Digital Ocean (cheaper).
3 - The programming language in this case (C++ or Java) is not that important. Focus more on your problem, architecture, deferred tasks, batch processing, etc. That will really make a difference.
No, the programming language doesn't much matter. It used to be the case that java was slower than C++ i believe, but that gap has closed pretty much as compilers have improved. If you want to run your applications better, try to design them in such a way that they are very efficient. Looking into Time Complexity may help, if you haven't already done so. The better your time complexity, the faster your program.
Related
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 6 years ago.
Improve this question
I am using JSP/Serverlets for my upcoming web application project. It is high traffic concurrent users web site. There has been many discussion about performance issues of Java 8 and especially in Streams.
Anyone having specific knowledge about performance of streams and whether its advisable to use in High traffic Web Applications so as to not compromise on latency and response time ?
As a general statement, outside of Java 8 Streams, it is pretty much impossible to answer your question as stated because it depends.
If you've got a method that is called hundreds of times per second then you would need to be very careful about performance. You'd want to tune it the best you could. Conversely, if you've got a method that gets called once a day then you likely wouldn't spend too much time optimizing it.
Streams are a useful tool when used correctly and they are easy to abuse. I've seen developers who thought it was a great idea to read an entire database table and use filtering with streams to effectively do a SQL "where" clause. That's a bad design but it honestly wouldn't be seen in the once-a-day method call.
Don't try to make these blanket "this is good or this is bad" statements. Do a good design and use the tools where they are appropriate. Optimize the parts of your application that need it but don't do pre-mature optimizations - you'll never finish the project.
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
Ok, it does not need to be something 100% secure. Something simple, that will cut 80% of people from using my demo library past 30 days and contact me.
The only thing I can think of is making my code save a file somewhere, with the date that the library started and after 30 days just exit displaying a message to contact for the full version. Of course, if the user finds out where this file is, all he has to do is delete it, so it would be nice if it could be in some kind of not so easy to find place (desktop or home directory would be silly I suppose).
Of course if he decompiles the code, he can easily turn that off, but again, I want some protection, even 50%, not 100%.
Target operating system is probably linux/unix, but I can also discover dynamically to make it work in any.
You don't mention the target operating system, so it is a little bit hard to answer the question. If your target is Windows, I would store the first start time in the Registry. Maybe this can help you.
I think your file strategy looks perfectly fine.
If you want to strengthen your scheme, you will have to contact a central service of some sort where you can detect if the same server tries to restart your evaluation time multiple times. The central server could i.e. sign a token with an expiry date that the library needs to run.
On the other hand, the more complicated this kind of schemes is, the more likely they are to fail at times and create problems for your legitimate users. You should consider this against the (probably very low) volume of users that would actively sabotage a more simple scheme.
PS: remember that in some environments multiple copies of different applications that uses your library may have to run simultaneously.
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 9 years ago.
Improve this question
I'm doing automation on data fetching using Java , which approach is better for task automation? Linux cronjob or Java Timer?
for example the tasks to execute hourly, first day of week, first day of month, thanks in advance.
If you need the application to be always running for some other reason, and the data fetching happen frequently, you can consider using java task.
If you will write an application just for this purpose, or it is an application you dont need to to be always open since its not perfoming other continuos action, i'd prefer a cronjob, so you can have the app out of the memory most time.
Also, notice cronjobs are very efficent, and fully trustable. So if the data frecuency is important and is not just related to some runtime features, i'd also prefer cronjob
This is just for mentioning a few high level scenarios, but as Keppil said, it could depend on many other aspects.
It might depend on what you want, but I will say that the times I have created automated tasks I have used cron jobs or Windows scheduled tasks. As Carlos stated, the Java program would have to be running in order to even be able to perform the operations. So if it is a production application and it dies, then the jobs can't be kicked off till it is brought back up again. Also, setting up a cron job is typically easier than writing a program.
On the other had, if it is a system that you do not have admin rights to and are unable to create or edit cron jobs but are able to kick off a Java program, the Java program might be easier.
Overall, the cron job seems to be the industry "best practice" (sorry for the buzz word), but, again, it might depend on your specific situation.
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 9 years ago.
Improve this question
I have a MATLAB code (including Simulink models) which I would like to make platform-independent, i.e., allowing them to run on web browsers and smartphone apps. Would coding it in Java be the best solution? And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again? Thanks for your suggestions!
Short answer: You'll have to recode
Would coding it in Java be the best solution?
Probably not. I've found that java is hardly ever the best solution. It may be the easiest, but I doubt it's the best. But for web-browsers, AFAIK, you must render some part down to javascript (even if it's just a shim to fetch data running on a server), flash, silverlight*, or java*. For iphone, you need to do it in C, Objective-C, or C++. I think Android uses some kind of java-like/based language, but I don't know. I doubt Win Mobile 8 even has a JVM, but don't really know there.
* Few people like to leave these plugins open. Too easy to exploit and few sites use them.
And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again?
Mathworks makes an m-code compiler, but you still need a lot of their libraries. It compiles for x86 under Windows and Linux. I think it supports a few other OS's, but all x86 unless they changed it around again. I guess you could try to get MCR working on a phone, but not in a web browser. Realtime Workshop renders simulink models to C, but not if they contain matlab function blocks (or some other blocks, I forget the full list). I hope you have a crap ton of cash, 'cause both those are expensive toolsets.
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 9 years ago.
Improve this question
Twitter has open sourced their Mysql source code.
This blog post http://engineering.twitter.com/2012/04/mysql-at-twitter.html mentions the different changes.
I have used Mysql as developer executing queries but never had to dig deep into its source code. I tried going through the source code on github https://github.com/twitter/mysql but was overwhelmed.
So thought I would post here and get some help.
I would like to better understand how Twitter's changes has improved
Mysql over the Oracle's version.
If I were to make an apples to apples comaparison between Oracle's version and Twitter's version what are specific advantages disadvantages between the two.
There are many more questions that popped into my head.
I get that this is sort of an advanced DB topic, but I would love learn about it.
They describe the changes as including:
Add additional status variables, particularly from the internals of
InnoDB. This allows us to monitor our systems more effectively and
understand their behavior better when handling production workloads.
Optimize memory allocation on large NUMA systems: Allocate InnoDB's
buffer pool fully on startup, fail fast if memory is not available,
ensure performance over time even when server is under memory
pressure.
Reduce unnecessary work through improved server-side
statement timeout support. This allows the server to proactively
cancel queries that run longer than a millisecond-granularity timeout.
Export and restore InnoDB buffer pool in using a safe and lightweight
method. This enables us to build tools to support rolling restarts of
our services with minimal pain.
Optimize MySQL for SSD-based machines,
including page-flushing behavior and reduction in writes to disk to
improve lifespan.
These are things that are important for a Twitter-scale web site. If you are building something that has to scale to that size - yes, those changes would be helpful. But, if you are building something more like every other mildly-popular web site in the world, you probably don't need to be concerned with their changes. Most large web sites that run MySQL run it straight from the distribution.