ZF2 DB based session management vs Redis - redis

I am not sure if this is the right place to post this.
I am writing a PHP and ZF2 based website that needs to be scalable. So, I am looking into Database based sessions. I understand ZF2 supports DB Session management, so I can create a MySQL DB, and use it. But DB session management could be slow. So, I have looked into redis as a cache management solution.
My question is will using redis as a standalone server work for both server side session management and a cache solution (as it seems to have it's own in memory DB) or do I need to combine it with ZF2 DB Session management?

Related

Switching from Local SQL to Azure SQL Database on Azure VM - Lower performance

Currently I am hosting my online application on an Azure VM. This is a pretty standard Umbraco website with around 300 visitors per day, nothing special here.
Details of Azure VM:
- Basic A3
- 4 cores
- 7 GB Memory
In the current situation MsSQL is installed on the VM itself and this is working fine, but I am not a great expert in maintenance. A solution I found is migrating the SQL database to SQL Azure.
Looking at my current website I decided to do this and I migrated the database to SQL Azure:
- S3 Standard
- 100 DTU
- 250GB
After the migration I switched the connection string with the connection string that was provided in the Azure portal. When I reloaded my website the loading time was suddenly three times slower.
For now I switched it back to the local SQL Database, but I am wondering if it is a normal situation that the local SQL is faster then SQL Azure in this case.
I hope someone can answer my question, please let me know if more information is required to answer my question.
Best regards, Martijn
EDIT
The issue is resolved! I found out that the SQL Azure Server that I created was located in a different region then the Azure VM. After I created a new SQL Azure server in the same region the performance issues where fixed.
Good to hear your perf issues are fixed. In general, comparing the performance of a local database versus a PaaS database is not always an apples-to-apples comparison for a number of reasons:
Azure SQL Database is a highly available service (99.99%) that requires synchronous commits to a secondary database. A local database typically is not configured for high availability.
Azure SQL Database provides automatic backup. Depending on your setup, a local database might may or may not be configured for backup.
The affect of network latency on a local database does not exist
The memory and CPU between of a S3 Azure SQL Database and a A3 VM are likely not the same

spring boot switching from in-memory database to persistent database

I have developed my web-application using spring-boot and spring-data-jpa and and in-memory database, and I have a couple questions:
how can i now switch to a persistent, let's say, MySQL database? What do I have to change in my configuration?
Can spring-boot set a database up for me with a specific port and where does it get stored in my file system?
Does IntelliJ provide a datasource browser for the created database?
I am sure this must be covered somewhere in the endless jungle of spring-boot documentation.
You can change the application properties for the datasource according to the link Gabor Bakos already provided.
That depends on the type of the database you want to use. HSQLDB and H2 allow you to specify a file path for the database file, however the database instance itself is still running within your application process. With full RMDBS like MySQL you have to install and configure the MySQL server yourself and provide the connection data to your Spring Boot application.
Yes, IntelliJ has a datasource browser for all major databases (maybe you have to download the database driver).

NHibernate Multiple Database Schema Reference to App_Data

Is it possible to do Multiple database connection where the main database is attached to SQL Server instance eg: (local) and another database is located in ASP.NET App_Data or it just a silly idea?
Technically speaking, that's possible. Note that, by using a database in App_Data, there is a great chance that you will have to struggle with security-related errors when running your app on IIS in production environment.
If it's a silly idea or not, depends on the intended usage of that app. IMHO, if it's a demo site to be run on a laptop during a meeting, why not. There is already a discussion on this matter here.

Install Sharepoint on a server with other databases already on it?

We have a DB server with a couple web app db's on there (don't get a ton of traffic). We'd like to make use of the server and allow it to be the DB server for sharepoint. I'm assuming it's not good practice and that sharepoint should have it's own exclusive db server. Am I right in that conclusion, or is it alright if we put the database on a server that already hosts other databases.
You can install SharePoint on an existing DB server, sure. Unless your environment is going to be huge, I don't see why you would give it its own DB server. It will use an embedded SQL Server instance if you want, but you'll get better performance if you have the full-blown version. We're running a few SharePoint apps on our DB server with a number of other applications.
The way in which I solve this is to install a second SQL Server instance dedicated to SharePoint, as SharePoint likes to have a lot of control over the database and spews all sorts of stuff such as logins, etc. across the instance, which you really want to separate from your standard line of business instance.
The added bonus is multiple SQL Server instances on the same physical machine are included in your licence.
Be careful with the SQL Server collation. I think SharePoint requires a particular setting for this. See http://www.moss2007.be/blogs/vandest/archive/2007/07/24/sharepoint-2007-and-sql-server-collation-latin1_general_ci_as_ks_ws.aspx for one reference.
Prior to centralizing our environment we had many Sharepoint sites located on servers with existing applications. I'm not a fan of adding an additional named instance as this increases the administrative overhead for the DBA. You have to know how much use you expect of your Sharepoint instance then measure the resource utilization of your existing applications balance it from there.

NHibernate monitor connections

Is there a way to monitor the round-trips to the database in an NHibernate application?
I need just a log to see when NHibernate connects to database.
Have a look at NHibernate Profiler (NHProf) if you don't mind a commercial product. Some of its features are:
Visual insight into the interaction between your database and application code.
Analysis and detection of common pitfalls when using NHibernate.
Analysis is delivered via perfectly styled SQL and linkable code execution.
Supports NHibernate (.NET) and Hibernate (Java).
You can 'monitor' via logging using NH's log4net. Some useful info here.
That will be monitor from the application side.
Have you tried monitoring from the DB serverside? E.g. enable logging at the say mySql.
In addition to NHProf and log4net, there is also a "show_sql" config entry that will dump the SQL to the console in a console app.
Your database vendor should also have tools for monitoring the SQL that is being run against it.